Re: recv blocks although socket is ready



Yes sure. That is not a problem. The problem is, that in blocking mode
select sometimes reports the socket readable and then the following
recv() blocks. Anyway, yesterday I changed the implementation to use
non-blocking sockets. But I wont be able to test it until friday when I
have access to the lab where the problem actually occurrs.

Michael

On Nov 13, 9:05 am, "Arkady Frenkel" <arka...@xxxxxxxxxxxxxxxx> wrote:
Any case you can sit forever ( up to data come ) on select() in
non-blocking mode as you are blocked
Arkady

<314.mich...@xxxxxxxxx> wrote in messagenews:1163348057.752364.325540@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I will try the sniffer thing if I get to it. Thanks for the hint.
I'm not sure if changing to non-blocking mode is really an option. The
application abstracts different network layers (tcp, udp with some
custom flow control, infiniband, quadrics teac...) into a common
interface. So I'd have to find a way to implement this without changing
the semantics of the interface. That is, I have to simulate blocking in
code for those members of the interface which have blocking semantics.

Michael

On Nov 12, 7:57 am, "Arkady Frenkel" <arka...@xxxxxxxxxxxxxxxx> wrote:
But non-blocking mode is what implemented in winsock from BSD, that
should
work on any platform, so worth to try that for sure, OTOH check if really
data arrived with some kind of sniffer at that moment.
Arkady

<314.mich...@xxxxxxxxx> wrote in
messagenews:1163261680.469048.85120@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Because this is a cross plattform application for AIX, Darwin, FreeBSD,
IRIX, IRIX64, Linux, OSF1, SunOS and Windows. I doesnt' make sense to
change something which works on all other plattforms and which ought to
work on Windows too. I'd rather like to know if this is a known issue
with blocking sockets, select and receive. If so I'd implement a
temporary fix until the issue is being addressed. If not, well I guess
I'm on my own ;-)

Michael

Alexander Nickolov wrote:
Why don't you make your socket non-blocking? Then
you'd get WSAEWOULDBLOCK which you can ignore.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnicko...@xxxxxxxx
MVP VC FAQ:http://www.mvps.org/vcfaq
=====================================

<314.mich...@xxxxxxxxx> wrote in message
news:1163184119.063002.123900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a strange problem using select() and recv(). Intermittedly it
occurs, that even though select() reports the socket to be readable
the
following call to recv() blocks. When I shutdown the other peer of
the
connection recv() returns and WSAGetLastError() returns
WSAESHUTDOWN.
This only occures on our Dell Workstation PWS670. I couldn't
reproduce
it on a different machine. I replaced the NIC with a different
modell
from a different vendor and installed a different driver but the
problem persited. Running the same app on the same hardware under
Linux
I was not able to reproduce the problem though.

Another point which seems worth noting is, that the problem occurs
more
frequently when there is some UDP traffic on another socket. This
traffic is consumed by another thread in my app which isn't affected
by
the blocking of the main thread.

My setup:
- Dell Workstation PWS670 4xXeon 3.6GHz, 3GB RAM,
- Intel(R) PRO/1000 MTW NIC or ProG-2000S (with Realtek driver)
- Windows XP SP2 (almost) fully patched

Any ideas?

Thanks,
Michael

.



Relevant Pages

  • Re: TCP Socket Using connect in Non Blocking - Results in errors using recv()
    ... >the flags to - setting the socket to blocking. ... >I subsequently use a listening thread which repeatedly calls recv() ...
    (comp.unix.questions)
  • Re: select.select and socket.setblocking
    ... recv (again, assuming that you use TCP as protocol, that is AF_INET, ... which in the blocking case would wait to receive all the ... with TCP protocol recv only returned less than ... use socket in blocking mode ...
    (comp.lang.python)
  • Re: select.select and socket.setblocking
    ... select between blocking and non-blocking mode. ... recv, which in the blocking case would wait to receive all the bytes that you requested, ... with TCP protocol recv only returned less than the required bytes if the remote end disconnects. ... If my process has only to deal with socket I/O, I make a blocking select, and then make an 'exact' recv on whichever socket the select signals. ...
    (comp.lang.python)
  • Re: Calling close(sock) in one thread doesnt make recv(sock,...) return
    ... > wakes up from a blocking recv(). ... socket call because you almost never are willing to wait forever for the ...
    (comp.os.linux.development.apps)
  • Re: Synchronization with CAsyncSocket in CE 6.0
    ... number of bytes in the first packet, followed by packets of, say 1024 bytes. ... recv() operations, reassembling it into the format that you need. ... don't forget that recv can return zero, if the socket has ... So, CAsyncSocket while possibly a bad way to do things, does not appear to ...
    (microsoft.public.windowsce.embedded)

Loading