trying to use sockcli.prg

trying to use sockcli.prg

Postby vilian » Mon Jul 31, 2006 7: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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby Antonio Linares » Tue Aug 01, 2006 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby vilian » Tue Aug 01, 2006 5:59 pm

Thanks Antonio,
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Postby vilian » Thu Apr 12, 2007 5: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
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 79 guests