beautypg.com

Solvline Eddy DK User Manual

Page 110

background image

Eddy DK Programmer Guide

110

SB_AcceptTcpMulti

Function

Grants network multiple connection of TCP socket handle waiting for
connection.

Format

Int SB_AcceptTcpMulti (int Socket_No, int wait_msec);

Parameter

Socket_No

wait_msec

TCP socket handle number waiting for connection.
(Return value of SB_ListenTcp)
Connection standby time (in msec)

Returns

-1 ~ N

New handle number of connected TCP socket.
-1: Socket error
0: Waiting for connection
N: New handle number of connected TCP socket.

Notice

When new handle number is given after connection is made, it will not close
previous handle waiting for connection, granting maximum of 1024 socket
connection.

SB_ReadTcp

Function

Read data from connected TCP socket.

Format

Int SB_ReadTcp (int Handle, char *Buffer, int Buffer_Size);

Parameter

Handle
Buffer
Buffer_Size

Handle number of connected TCP socket
Buffer point where packet data to be read will be saved
Size of the buffer to save

Returns

-1 ~ N

Size of the data read.
-1: Socket error
0: No data was read
N: Length of the data read

Notice

When return code is -1, it means the connection is lost with the client so
user has to close TCP socket handle.

SB_CloseTcp

Function

Close TCP socket handle.

Format

Int SB_CloseTcp (int Handle);

Parameter

Handle

TCP socket handle number to close

Returns

None

Notice

This function shuts down socket handle to finish communication and
closes.