Author | Topic: Problems with SocketCount | |
---|---|---|
Bernd Reinhardt | Problems with SocketCount on Thu, 17 Oct 2002 14:55:17 +0200 Hi, I use a socketconnetcion with a ComServer. I can connect to this ComServer, an send a String to the comServer via SocketSend. If the ComServer repeats Data on his serverside, I can read this characters with SocketRecvStr. So far so good. BUT: SocketRecvStr waits for ever. There is no timeount. So if the ComServer get no Data on his side SocketRecvStr is the same as wait forever. So I thought, I change my program an use nBytes = socketCount(nSocket) But nBytes is always 0, but I's sure that a String is available. With the debugger I can set nByte for example to 1, so I get a character form Socket. But Socketcount is always 0. nStopSend := seconds() nStartSend := seocnds() do while .t. nBytes := socketCount(nSocket) Ask for available Data if nBytes > 0 When I'm sure a charcter is available, I set nBytes (with debugger) to 1, Then I get the character from the socket. cEmpfString := SocketRecvStr( nSocket , nBytes, @nError ) read Data ?? cEmpfString endif nSecStart := seconds() if (nSecStart - nSecStop) > 10 Timeout for 10 seconds exit endif enddo Is there a bug in SocketCount. Is a timeout for socketRecvStr possible. With an extra thread I also have no posibility to break the SocketRecvStr. Only Alt C can break the programm. Any Idea? Thanks for help Bernd | |
Uwe Gellhaus | Re: Problems with SocketCount on Thu, 17 Oct 2002 20:53:00 +0200 > BUT: SocketRecvStr waits for ever. There is no timeount. So if the ComServer > get no Data on his side > SocketRecvStr is the same as wait forever. you could change "blocking mode" with SocketSetBlockingMode(). Does this change something ? To determine the status of sockets you can use SocketSelect(). Regards Uwe | |
Bernd Reinhardt | Re: Problems with SocketCount on Fri, 18 Oct 2002 09:15:02 +0200 Hi Uwe. Thanks a lot. With blockmode off socketrecvstr() is working, and not waiting for ever. Regards Bernd "Uwe Gellhaus" <nospam@rissoft.de> schrieb im Newsbeitrag news:3daf0664$1@asgcom.alaska-software.com... > > BUT: SocketRecvStr waits for ever. There is no timeount. So if the ComServer > > get no Data on his side > > SocketRecvStr is the same as wait forever. > > you could change "blocking mode" with SocketSetBlockingMode(). > Does this change something ? > > To determine the status of sockets you can use SocketSelect(). > > Regards > Uwe |