Hello Mr. Antonio
Thank you for answer my questions.
1. Ex.1 code is available.
2. Ex.2 code is not available.
Ex.1 (oClient:bWrite) is working.
oClient:bWrite := { | oClient | OnConnect( oClient ) } <- Here
Ex.2 (oClient:bConnect) is not working. Why it does not work ?
oClient:bConnect := { | oClient | OnConnect( oClient ) }
Client does not have METHOD of bConnect ?
-------------------------------------------------------------------------------------
1. Ex.1 code is available.
-------------------------------------------------------------------------------------
EX 1]
Code: Select all
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
[View 'C:\tcpip.txt' Code]
10/23/06 09:59:28: Accept Socket handle: 1892
10/23/06 09:59:28: Write Socket handle: 1860
10/23/06 09:59:28: Write Socket handle: 1860
-------------------------------------------------------------------------------------
2. Ex.2 code is not available.
-------------------------------------------------------------------------------------
EX 2]
Code: Select all
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
yunbg.