sockets

sockets

Postby don lowenstein » Thu Aug 23, 2007 11:54 pm

I need to write to a socket and receive data from that socket.

Has anyone out there been successful with this?

I tried to telnet a socket address and was successful. However, using the FWH sample socket prg's I receive a -1 on that same ip / port address.

Any magic required here?
Don Lowenstein
www.laapc.com
User avatar
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm

Postby Antonio Linares » Fri Aug 24, 2007 7:42 am

Don,

Please have a look at samples\sockserv.prg and sockcli.prg
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 don lowenstein » Mon Aug 27, 2007 10:51 pm

Antonio,

I'm having erratic results on reading the return response from the host. I have inserted timing loops, etc but can't get consistant.

With the test programs and msgstop's and debugger, things work well. In my application, it's almost like sometimes I'm active and receive the host messages, other times I "miss" them. I'm telling my app to sleep() and inkey(.25) etc, then testing for the getdata(), but most times (not all) the returned data is empty. I do know that the host side is returning data.

Question: Why won't the getdata() method work consistantly? Also, in the sample programs, when the socket is getting ready to close, a msginfo() is invoked, and this in turn invokes the onread event. Almost like without the msginfo() the socket doesn't "wake up" for handling the read event. Does this make sense?

How can I control the onread event BEFORE ending the socket.
Don Lowenstein
www.laapc.com
User avatar
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm

Postby James Bott » Tue Aug 28, 2007 12:44 am

Don,

I'm no socket expert, but you can turn on debug logging and this may give you some clues. Try:

oSocket:lDebug:=.t.
oSocket:cLogFile:="socket.log"

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

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