beautypg.com

ProSoft Technology MVI69-ADMNET User Manual

Page 73

background image

MVI-ADMNET ♦ 'C' Programmable

Application Development Function Library - ADMNET API

'C' Programmable Application Development Module with Ethernet

Developer's Guide

ProSoft Technology, Inc.

Page 73 of 122

February 20, 2013

ADM_receive_sk

Syntax

int ADM_receive_sk(char *skName, char *holdRecPtr, int *readLen, char *fromIP);

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.

fromIP

Pointer to character array which in turn return with client IP.

Description
This function receives socket after ADM_open_sk is used. skName must be a
valid name that has been initialized with ADM_init_socket.

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.

SK_TIMEOUT

Time out opening socket.

Example

char sockName1[ ] = "SendSocket";
char holdingReg[100];
int result;

while ((result=ADM_receive_sk(sockName1, holdingReg, &readLen, fromIP)) ==
SK_PROCESS_SOCKET);

if(result == SK_SUCCESS){
printf("Received data!\n");
printf("Length == %d\n", readLen);
for (i=0; i {
printf("%c", *(holdingReg+i));
}
printf("\n");

} else {
printf("Received no data Error: %d\n",result);
}