I am trying to use sockcli.prg. I connect in the server, but I do not obtain to send nothing! If active log I see the following one:
07/31/06 16:43:02: Connect Socket handle: 1928
07/31/06 16:43:02: Write Socket handle: 1928
07/31/06 16:43:26: IMP01|0|0001|
07/31/06 16:44:32: IMP01|0|0001|
#include "FiveWin.ch"
static oWnd, oSocket
function Main()
local oBar
DEFINE WINDOW oWnd TITLE "Client socket"
DEFINE BUTTONBAR oBar OF oWnd _3D
DEFINE BUTTON OF oBar ACTION Client() TOOLTIP "Connect"
DEFINE BUTTON OF oBar ;
ACTION oSocket:SendData( "IMP01|0|1001|" ) ;
TOOLTIP "Send data"
DEFINE BUTTON OF oBar ;
ACTION SendFile() TOOLTIP "Send file"
ACTIVATE WINDOW oWnd
return nil
FUNCTION Client()
LOCAL n
oSocket = TSocket():New( 1853 )
oSocket:lDebug := .T.
oSocket:cLogFile := "LOG.TXT"
oSocket:bRead = { | oSocket | MsgInfo( oSocket:GetData() ) }
// Never use a MsgInfo() here because it hangs Windows!!!
oSocket:bConnect = { || oWnd:SetText( "Connected!" ) }
oSocket:bClose = { || MsgInfo( "Server has closed!" ) }
oSocket:Connect( "10.10.1.1" ) // use the server IP address here
RETURN nil
FUNCTION SendFile()
LOCAL uBuff
uBuff := oSocket:GetData()
RETURN nil