Hi all.
Questions about WinSock TCP/IP.
We are Server, others are Clients.
Clients can send message to server.
How can server send a message to specific client ?
How does server send a message to client anytime ?
Thanks.
yunbg.
FWH USER.
oSocket := TSocket():New( 8000 )
oSocket:cLogFile := "c:\tcpip.txt"
oSocket:lDebug := .t.
oSocket:bAccept := { | oSocket | ;
oClient := TSocket():Accept( oSocket:nSocket ),;
oClient:Cargo := ST_COMMAND,;
oClient:bRead := { | oSocket | OnRead1( oSocket ) },;
oClient:bWrite := { | oClient | OnConnect( oClient ) },; <- Here
oClient:bClose := { | oSocket | OnClose1( oSocket ) } }
oSocket:Listen()
//-----------------------------------------------------------------------------------
FUNC OnConnect(oClient)
oField[01]:Append( time()+ str(oClient:nSocket,5) + " : Client Connect..." + CRLF, 1)
RETU NIL
oSocket := TSocket():New( 8000 )
oSocket:cLogFile := "c:\tcpip.txt"
oSocket:lDebug := .t.
oSocket:bAccept := { | oSocket | ;
oClient := TSocket():Accept( oSocket:nSocket ),;
oClient:Cargo := ST_COMMAND,;
oClient:bRead := { | oSocket | OnRead1( oSocket ) },;
oClient:bConnect := { | oClient | OnConnect( oClient ) },; <- Here
oClient:bClose := { | oSocket | OnClose1( oSocket ) } }
oSocket:Listen()
//-----------------------------------------------------------------------------------
FUNC OnConnect(oClient)
oField[01]:Append( time()+ str(oClient:nSocket,5) + " : Client Connect..." + CRLF, 1)
RETU NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Silvio.Falconi and 81 guests