win32 socket, "Operation not supported"

Discussion in 'Python' started by David Konerding, Dec 12, 2003.

  1. 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
     
    David Konerding, Dec 12, 2003
    #1
    1. Advertising

  2. David Konerding

    Dave Brueck Guest

    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
     
    Dave Brueck, Dec 12, 2003
    #2
    1. Advertising

  3. David Konerding <> 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
     
    Thomas Heller, Dec 12, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Nagy
    Replies:
    1
    Views:
    4,917
    Mark Wooding
    Jan 27, 2009
  2. Jean-Paul Calderone
    Replies:
    0
    Views:
    991
    Jean-Paul Calderone
    Jan 27, 2009
  3. Laszlo Nagy
    Replies:
    0
    Views:
    565
    Laszlo Nagy
    Feb 1, 2009
  4. Steve Holden
    Replies:
    0
    Views:
    683
    Steve Holden
    Feb 1, 2009
  5. Joe Ruby MUDCRAP-CE

    'exec': Operation not supported

    Joe Ruby MUDCRAP-CE, Nov 8, 2006, in forum: Ruby
    Replies:
    1
    Views:
    128
    Justin Collins
    Nov 8, 2006
Loading...

Share This Page