' Rapid-Q by William Yu (c)1999-2000 . ' ================================================================================ ' Upload_il_tuo_script_su_Rapidq.it ' Qsocket ****** QSOCKET Component ****** QSocket provides an easy to use interface to communicate between server/client with sockets. QSocket Properties Field Type R/W Default Support =============== =============== =============== =============== =============== Family INTEGER RW AF_INET W Family specifies the address family. LParam INTEGER RW FD_CONNECT W LParam specifies the message to capture when you set WMessage and handle the message processing by assigning a new WndProc to your form. MySocket INTEGER R WXG MySocket stores the result of operations such as Open. So instead of using the return value of Open, you can use the property MySocket. Parent QFORM W W Protocol INTEGER RW IPPROTO_IP W Tag INTEGER RW WXG Transferred INTEGER R WXG Type INTEGER RW SOCK_STREAM W WMessage INTEGER RW 0 W WMessage specifies a user defined message to be passed to your form for non-blocking calls, ie. Connecting. QSocket Methods Method Type Description Params Support =============== =============== =============== =============== =============== FUNCTION Accepts Client Accept ClientSock% Connection 1 WXG (Socket%) Close SUB (Socket%) Closes Socket% 1 WXG file descriptor FUNCTION Sock% Connect to Connect (ServerName$, server on 2 WXG PortNum%) PortNum% FUNCTION Bool% True/False if ConnectionReady (Sock%) connection 1 WXG pending GetHostIP FUNCTION AS Returns host IP 0 WXG STRING Address GetHostName FUNCTION AS Returns host 0 WXG STRING name FUNCTION Returns peer GetPeerName GetPeerName$ name 1 WXG (Socket%) FUNCTION Bool% True/False if IsClientReady (Sock%, client is 2 WXG ClientSock%) sending data FUNCTION Bool% True/False if IsServerReady (Sock%) server is 1 WXG sending data Open FUNCTION Sock% Open TCP server 1 WXG (PortNum%) on PortNum% Peek FUNCTION Peek$ information Peek (Socket%, coming from 2 W NumBytes%) socket, but do not clear. Win32 FUNCTION Read Message$ Read NumBytes% 2 WXG (Socket%, NumBytes%) FUNCTION Read a single ReadByte (Socket%) AS byte 2 WXG BYTE FUNCTION Read complete ReadLine Message$ line 1 WXG (Socket%) SUB (Socket%, Sends NumBytes% Write Message$, from Message$ 3 WXG NumBytes%) WriteByte SUB (Socket%, B Sends a single 2 WXG AS BYTE) byte FUNCTION Bytes% WriteLine (Socket%, Send Message$ 2 WXG Message$) 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. ' =============================================================================== ' 2003 Holyguard.net - 2007_Abruzzoweb