Application Development Function Library: ADMNET API
MVI-ADMNET
♦
'C' Programmable
Ethernet Module
ProSoft Technology, Inc.
Page 39 of 90
December 13, 2006
ADMNET API Initialize Functions
The following topics detail the ADMNET API Initialize functions.
ADM_init_socket
Syntax:
int ADM_init_socket(int numSK, int portNum, int buffSize, char *name);
Parameters:
numSK
Variable indicating how many sockets to use.
portNum Port
Number.
buffSize
The size of the buffer available in each socket.
name
The name of the socket.
Description:
ADM_init_socket acquires access to the ADMNET API and dynamically
generates a set of sockets according to numSK and assigns portNum, buffSize,
then names each socket that the application will use in subsequent functions.
This function must be called before any of the other API functions can be used.
IMPORTANT
: After the API has been opened, ADM_Release_Sockets should
always be called before exiting the application.
Return Value:
SK_SUCCESS
API has successfully initialized variables.
SK_PORT_NOT_ALLOW
API does not allow port number used.
SK_CANNOT_ALLOCATE_MEMORY
API cannot allocate memory.
Example:
int numSK = 5;
int portNum = 5757;
int buffSize = 1000;
if(ADM_init_socket(numSK, portNum, buffSize, "ReceiveSK") != SK_SUCCESS)
{
printf("\nFailed to open ADM API... exiting program\n");
ADM_release_sockets();
}
See Also:
ADM_release_sockets