Mailing List Archive

Select weirdness on Solaris 2.4
In article <199904011702.MAA06784@eric.cnri.reston.va.us>,
Guido van Rossum <guido@CNRI.Reston.VA.US> wrote:
> Georg Mischler wrote:
>
> > So the question now turns away from asyncore and towards python
> > internals. Can anyone spot the crucial difference between the
> > following C (compiled with -lsocket -lnsl) and what python does
> > with the 6 lines from above?
>
> Here's another suggestion. Aren't there two socket implementations in
> Solaris? One SysV compatible and one BSD compatible? Does Python
> link with the same set of libraries as your little C program?


Thanks for all the suggestions from everybody.

I finally gave up when I found the following in asyncore.py:

if os.name == 'mac':
# The macintosh will select a listening socket for
# write if you let it. What might this mean?
def writable (self):
return not self.accepting
else:
def writable (self):
return 1

This showed me that the problem is not unique to my system,
and also pointed me to the solution. My derived class now
overwrites:

def writable(self):
return not self.accepting

Since I know that the dispatcher will never write anything
to any socket (why should it?), this is save and will end
my headaches. I still don't understand the behaviour of
select in this case, but I leave that to the socket experts
to ponder...

as-long-as-it-works-don't-ask-why-ly yrs

-schorsch

--
Georg Mischler -- simulation developper -- schorsch at schorsch.com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Select weirdness on Solaris 2.4 [ In reply to ]
Georg Mischler wrote:
>
> Balk means: list two handle_writes and a socket.error: "socket
> not connected".

When select returns true for an operation, it doesn't
necessarily mean that the operation will succeed -
only that the call won't block.