FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour trying to use sockcli.prg
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
trying to use sockcli.prg
Posted: Mon Jul 31, 2006 07:44 PM

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

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
trying to use sockcli.prg
Posted: Tue Aug 01, 2006 05:32 PM

Vilian,

If you are testing both samples\sockserv.prg and samples\sockcli.prg at the same computer, then you have to change this line in sockcli.prg:

oSocket:Connect( "127.0.0.1" ) // use the server IP address here

Here they are working fine with FWH 2.7 July 2006.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
trying to use sockcli.prg
Posted: Tue Aug 01, 2006 05:59 PM

Thanks Antonio,

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
trying to use sockcli.prg
Posted: Thu Apr 12, 2007 05:37 PM

Antonio,

How I make in sockserv.prg to return information to sockcli.prg?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil

Continue the discussion