Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > win32 socket, "Operation not supported"

Reply
Thread Tools

win32 socket, "Operation not supported"

 
 
David Konerding
Guest
Posts: n/a
 
      12-12-2003

Hello,

I have written an app which opens a TCP connection to a server and uses a protocol to communicate with it.
Specifically, I've written a python IMD client for the molecular dynamics application 'NAMD' (do searches for IMD and NAMD if you want to learn more).

The protocol is very simple: both ends of the TCP connection can send messages to the other side at any time; when data is
available on a read socket, a full packet (with known size) is read in a blocking fashion from the socket.

This is used, on the client side, to make requests of the molecular dynamics engine (such as "speed up", or "slow down", or "quit").
The server side periodically sends updates on the state of the molecular dynamics engine (current step, atomic coords, etc).

This all works fine on linux: I can connect, and send and receive messages as necessary.

However, on Windows, I can connect and complete the initial handshake, and receive periodic updates, but when I try to send a message
to the server, socket.send gets an "Operation not supported".

From my reading of the win32 docs, the socket send call returns this in a couple of situations:
when a two-way socket had one half shut down and the send would have used the shut down direction, or
when an out of band message was sent on a socket type which does not support it (such as UDP).

Neither of these situations are true. When I re-code the app in C, the problem doesn't occur. Anybody got some suggestions?
(PS: the socket I/O is set to blocking, and the Nagle algorithm is disabled).

Dave
 
Reply With Quote
 
 
 
 
Dave Brueck
Guest
Posts: n/a
 
      12-12-2003
David wrote:
> I have written an app which opens a TCP connection to a server and uses a

protocol to communicate with it.
> Specifically, I've written a python IMD client for the molecular dynamics

application 'NAMD' (do searches for
> IMD and NAMD if you want to learn more).
>
> The protocol is very simple: both ends of the TCP connection can send

messages to the other side at any time; when data is
> available on a read socket, a full packet (with known size) is read in a

blocking fashion from the socket.

Are you doing a select or poll on the socket to ensure the read won't block?
(not relevent to your problem, just trying to understand your program)

> However, on Windows, I can connect and complete the initial handshake, and

receive periodic updates, but when I try to
>send a message
> to the server, socket.send gets an "Operation not supported".
>
> >From my reading of the win32 docs, the socket send call returns this in a

couple of situations:
> when a two-way socket had one half shut down and the send would have used the

shut down direction, or
> when an out of band message was sent on a socket type which does not support

it (such as UDP).
>
> Neither of these situations are true. When I re-code the app in C, the

problem doesn't occur. Anybody got some suggestions?
> (PS: the socket I/O is set to blocking, and the Nagle algorithm is disabled).


Could you send a stripped-down version of the Python code? If nothing else,
other Windows users can try it out too and report back their results.

-Dave


 
Reply With Quote
 
 
 
 
Thomas Heller
Guest
Posts: n/a
 
      12-12-2003
David Konerding <(E-Mail Removed)> writes:

> Hello,
>
> I have written an app which opens a TCP connection to a server and
> uses a protocol to communicate with it. Specifically, I've written a
> python IMD client for the molecular dynamics application 'NAMD' (do
> searches for IMD and NAMD if you want to learn more).
>
> The protocol is very simple: both ends of the TCP connection can send
> messages to the other side at any time; when data is available on a
> read socket, a full packet (with known size) is read in a blocking
> fashion from the socket.
>
> This is used, on the client side, to make requests of the molecular
> dynamics engine (such as "speed up", or "slow down", or "quit"). The
> server side periodically sends updates on the state of the molecular
> dynamics engine (current step, atomic coords, etc).
>
> This all works fine on linux: I can connect, and send and receive
> messages as necessary.
>
> However, on Windows, I can connect and complete the initial handshake,
> and receive periodic updates, but when I try to send a message to the
> server, socket.send gets an "Operation not supported".
>
> From my reading of the win32 docs, the socket send call returns this
> in a couple of situations: when a two-way socket had one half shut
> down and the send would have used the shut down direction, or when an
> out of band message was sent on a socket type which does not support
> it (such as UDP).
>
> Neither of these situations are true. When I re-code the app in C,
> the problem doesn't occur. Anybody got some suggestions? (PS: the
> socket I/O is set to blocking, and the Nagle algorithm is disabled).


I have no idea, and if it works in C it should also work in Python .

OTOH, the approach you take sounds a little strange - if you communicate
with fixed size packets wouldn't UDP datagrams fit better? This would
IIUC also remove the requirement to disable the nagle algo.

Thomas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python-ldap/win32 or python/ldap/win32 rcmn Python 1 11-06-2006 11:47 PM
Dave Roth's site (Win32::AdminMisc, Win32::ODBC, etc.) not available. Jim Roberts Perl Misc 7 01-04-2006 02:36 PM
win32 process information, using win32 extension Java and Swing Python 1 10-24-2005 09:13 PM
RE: win32 process information, using win32 extension Tim Golden Python 0 10-21-2005 02:18 PM
Hmmm... problems with CPAN (MakeMaker?) on Win32+MSYS or Win32+UnixUtils and others Alex Lyman Perl 0 03-07-2004 05:10 PM



Advertisments