Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSOCKET

QSOCKET Component

QSocket provides an easy to use interface to communicate between server/client with sockets.

QSocket Properties

Family specifies the address family.
LParam specifies the message to capture when you set WMessage and handle the message processing by assigning a new WndProc to your form.
MySocket stores the result of operations such as Open. So instead of using the return value of Open, you can use the property MySocket.
WMessage specifies a user defined message to be passed to your form for non-blocking calls, ie. Connecting.

QSocket Methods

AcceptFUNCTION ClientSock%(Socket%)Accepts Client Connection1WXG
CloseSUB (Socket%)Closes Socket% file descriptor1WXG
ConnectFUNCTION Sock%(ServerName$, PortNum%)Connect to server on PortNum%2WXG
ConnectionReadyFUNCTION Bool%(Sock%)True/False if connection pending1WXG
GetHostIPFUNCTION AS STRINGReturns host IP Address0WXG
GetHostNameFUNCTION AS STRINGReturns host name0WXG
GetPeerNameFUNCTION GetPeerName$(Socket%)Returns peer name1WXG
IsClientReadyFUNCTION Bool%(Sock%, ClientSock%)True/False if client is sending data2WXG
IsServerReadyFUNCTION Bool%(Sock%)True/False if server is sending data1WXG
OpenFUNCTION Sock%(PortNum%)Open TCP server on PortNum%1WXG
PeekFUNCTION Peek$(Socket%, NumBytes%)Peek information coming from socket, but do not clear. Win322W
ReadFUNCTION Message$(Socket%, NumBytes%)Read NumBytes%2WXG
ReadByteFUNCTION (Socket%) AS BYTERead a single byte2WXG
ReadLineFUNCTION Message$(Socket%)Read complete line1WXG
WriteSUB (Socket%, Message$, NumBytes%)Sends NumBytes% from Message$3WXG
WriteByteSUB (Socket%, B AS BYTE)Sends a single byte2WXG
WriteLineFUNCTION Bytes%(Socket%, Message$)Send Message$2WXG

QSocket Examples
See the chatserver.bas and chatclient.bas (or chatserv.bas and chatcli.bas for Windows)
included in the Rapid-Q distribution.
Also take a look at http.bas included in the Rapid-Q for Windows distribution.

Prev Component Contents Next Component