Function ConnectToServer(Server, Port, Buffer, BufLen)
Local Code
* connect to TCP server and read it's greeting message
Local DataSock
* the client connects to the server
DataSock = cscClient(Server, Port)
* error ? (negative return codes are errors)
if DataSock < 0
return DataSock
endif
* wait (3 sec) for greeting message from server
if cscAwaitData(DataSock, 3000) <> 0
* read server's greeting message into Buffer
Code = cscGetData(DataSock, Buffer, BufLen)
if Code < 0
return Code
endif
* return (virtual) data socket
return DataSock
endif
* timed out
return CSC_CONNECT_TIMEOUT
HOME PAGE
MARSHALLSOFT is a trademark of MarshallSoft Computing, Inc.