P
Pawan Singh
Hi,
Using .Net sockets, with the following piece of code, there is always a
problem. The loop never reads any data from the socket. But if the busy wait
is removed with sleeps, it does read the data. It seems as if some other
framework thread reading the data from TCP stack in windows and updating
available, is not able to run at all. Should that thread not be able to run
even if this thread is using a lot of CPU. I thought that Windows was a time
sharing O/S.
-Pawan
startTimestamp = now
while true
Dim num as integer = sock.Available
if num > 0 then
Read from socket
endif
if now.subtract(startTimestamp).TotalMilliseconds > 500 then
exit while
endif
' or use this piece which makes it work
' thread.Sleep(500)
'
end while
Using .Net sockets, with the following piece of code, there is always a
problem. The loop never reads any data from the socket. But if the busy wait
is removed with sleeps, it does read the data. It seems as if some other
framework thread reading the data from TCP stack in windows and updating
available, is not able to run at all. Should that thread not be able to run
even if this thread is using a lot of CPU. I thought that Windows was a time
sharing O/S.
-Pawan
startTimestamp = now
while true
Dim num as integer = sock.Available
if num > 0 then
Read from socket
endif
if now.subtract(startTimestamp).TotalMilliseconds > 500 then
exit while
endif
' or use this piece which makes it work
' thread.Sleep(500)
'
end while