Alaska Software Inc. - Bug in SocketCount?
Username: Password:
AuthorTopic: Bug in SocketCount?
Bernd ReinhardtBug in SocketCount?
on Mon, 07 May 2007 16:00:06 +0200
Hi,
I have a connection to a deviceserver on TCP-Port 8000.
SocketBlockingmode is off because I'm polling the Port not waiting untill 
all expected data available.
I always got nAnzahl == 0, so I tried the code below to see whats happen.
Because of this I think there is a bug in SocketCount.

            nAnzahl := SocketCount( nComServerSocket)     I check if data 
is available, only for testing if socketCount works right.
            cEmpfFirst := cEmpfang     Remember String before reading data
            cEmpfang := cEmpfang + socketRecvStr(nComServerSocket, 9999, 
@nError)   Read data
            if len(cEmpfang) > len(cEmpfFirst)   data arraived on Socket, 
now print nAnzahl ( read before reading data)
               @ 5,5 say "Count: " + str(nAnzahl,3) + "  " + time()   
nAnzahl is always 0  wheater data arraived on port.or not.
            endif

My communication with the deviceserver works right, there is no error. I can 
send and receive Data on Port 8000 when I don't care
about socketcount().

if I do like this:

   nAnzahl := SocketCount( nComServerSocket)
  if nAnzahl > 0   data available for reading
   cEmpfang := cEmpfang + socketRecvStr(nComServerSocket, nAnzahl, @nError) 
 Read data
endif

I get no Data because nAnzahl is always 0 zero !

Any idea whats wrong

Thanks for help
regards
Bernd