
Application Development Function Library - ADMNET API MVI-ADMNET ♦ 'C' Programmable
Developer's Guide 'C' Programmable Application Development Module with Ethernet
Page 72 of 122 ProSoft Technology, Inc.
February 20, 2013
5.5 ADMNET API Receive Socket Functions
This section describes the ADMNET API Receive Socket functions.
ADM_receive_socket
Syntax
int ADM_receive_socket(char *skName, char *holdRecPtr, int *readLen, int
protocol);
Parameters
Name of the socket that has been initialized and used to receive data.
Pointer to a buffer to hold data that will be received by the API.
Length of data received by the API.
Specified protocol to receive over Ethernet (USE_TCP or USE_UDP).
Description
To simplify a program, this function opens connection and receives message.
Return Value
Socket is successfully sent.
Socket could not be found.
Socket is in the process of sending.
Example
char hold[5000];
int readLen;
int se, i;
se = ADM _receive_socket("receiveSK", holdingReg, &readLen, USE_UDP);
if(se == SK_SUCCESS)
{
printf("Length == %d\n", readLen);
for (i=0; i<readLen; i++)
{
printf("%02X ", *(holdingReg+i));
if(i%10 == 0) printf("\n");
}
printf("\n");
}
See Also
ADM_send_socket (page 70)
Komentáře k této Příručce