Admnet api receive socket functions – ProSoft Technology MVI69-ADMNET User Manual
Page 72

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
skName
Name of the socket that has been initialized and used to receive data.
holdRecPtr
Pointer to a buffer to hold data that will be received by the API.
readLen
Length of data received by the API.
protocol
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
SK_SUCCESS
Socket is successfully sent.
SK_NOT_FOUND
Socket could not be found.
SK_PROCESS_SOCKET
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
printf("%02X ", *(holdingReg+i));
if(i%10 == 0) printf("\n");
}
printf("\n");
}
See Also
ADM_send_socket (page 70)