WATTCP API Functions
MVI-ADMNET
♦
'C' Programmable
Ethernet Module
ProSoft Technology, Inc.
Page 53 of 90
December 13, 2006
tcp_open
Syntax:
int tcp_open( tcp_Socket *sk, word lPort, longword ina, word port, dataHandler_t
datahandler );
Parameters:
sk
Pointer to the socket that has been initialized.
lPort
Local port number.
ina
Host IP Address.
port
Host port number.
datahandler
Data Handler. Not used in this version. Use NULL for this parameter.
Description:
This function opens a TCP socket connection to a host machine using
parameters passed to it.
IPort
is an option parameter. Most of the time,
IPort
can
be set to 0. The API will find an available port number for the socket.
ina
is a host
IP address passed as a longword. Function resolve can be used to convert an IP
address into longword-formatted variable.
Return Value:
Connection cannot be made
>0
Connection is made
Example:
tcp_Socket *socket;
. . .
if(tcp_open(socket, 0, resolve("192.168.0.1"), 5656, NULL))
{
printf("Open Successfully\n");
}
See Also:
resolve