
SDK Programming Guide Version 1.511
ABLELink
R
Ethernet-Serial Server MAXI Series
tcp_listen()
Description:
Establish a connection by server site.
Include:
tcpapi.h, tcpdef.h
Usage:
int tcp_listen (
int far *
phandle
,
unsigned short
fromPort
,
farFUNC
postfunc
,
char far *
parg
)
phandle:
the pointer of unique handle of the establishing
connection
fromPort:
local TCP socket port number
parg:
pointer of arguments to pass to post-function
Input Parameters:
postfunc:
entry point of the post-function
Return Value:
SUCCESS
connect is successful
others
error, please refer to the file
tcpdef.h
Example:
Please refer to
tcp_connect
.
Remarks:
This function is used by the server device to establish a connection with the
client device. Upon the client issuing
tcp_connect
command, the
connection will be established accordingly.
tcp_disconnect()
Description:
Disconnect the established connection.
Include:
tcpapi.h, tcpdef.h
Usage:
int tcp_disconnect (int
handle
)
Input Parameters:
handle:
the unique handle of the established connection
Return Value:
SUCCESS
disconnect is successful
others
error, please refer to the file
tcpdef.h
Example:
Reconnect to the device of server site.
tcp_discount ( handle );
// disconnect the established connection
wait ( 5 );
// wait for 5 seconds
tcp_connet ( …. )
// establish a new connection
Remarks:
This function is used by the client and severs devices to disconnect the
connection that has already been established. After calling this function one
of the devices (client or server) will disconnect first and the other device will
disconnect in 5 seconds for garbage processing. You can establish a new
connection between these two devices again.
Copyright © 2004 Atop Technologies, Inc.
All rights reserved. Designed in Taiwan.