Socket module bug on OpenVMS

Irmen de Jong irmen.NOSPAM at xs4all.nl
Tue Oct 24 00:44:44 CEST 2006


Fredrik Lundh wrote:
> Irmen de Jong wrote:
> 
>> This also raises the question to what extent Python itself should
>> work around platform specific "peculiarities", such as this one.
>> There's another problem with socket code on Windows and VMS systems,
>> where you get strange exceptions when using a "too big" recv() buffer.
> 
> what's a "strange exception" and a "too big" buffer?

The exceptions are MemoryError (I know this one for sure)
and a socket.error I believe (can't remember exactly, and I don't
have a VMS machine to try to reproduce).
Too big buffer means anything above 64 kilobyte or so.

You can find a lot of reports about this happening on Windows at least.
 From user reports I've learned that VMS also has similar problems with
recv buffer sizes above a certain size.

>> Things like this force me into writing all sorts of error checking
>> code or platform specific functions, to work around these bugs.
>> Just for what was supposed to be a simple socket recv() and a
>> simple socket send()...
> 
> if you want buffering, use makefile().  relying on platform-specific 
> behaviour isn't a good way to write portable code.

I'm not sure if makefile() would shield me from the problems I experienced
(I could try I suppose) but your second remark is exactly my point!
I don't *want* to code around platform-specific behavior. I *want* my
code to be portable. And I expected it to be portable by just using
a regular recv() call... However as it is now, Python's socket module
exposes platform specific (and troublesome) behavior, so I have to write
various workarounds to make my code run without errors on multiple platforms...

Regards,

--Irmen de Jong



More information about the Python-list mailing list