Help with IO::socket simultaneous read and write

Discussion in 'Perl Misc' started by Steve D, Sep 4, 2003.

  1. Steve D

    Steve D Guest

    I've created an application that opens sockets (using IO::Socket) and
    then creates two ithreads, one that reads the socket and one that
    writes it. It appears that if there is a "read" pending (sysread,
    recv, or read) on a socket, then a "write" (syswrite, send or print)
    on that socket hangs.

    (In fact, it appears that if there is a "read" on *any* socket file
    handle, then a "write" on any other hangs, but I need to verify that
    carefully).

    Before I put the reader's in, the writers were working just fine.

    Is this known behavior with sockets?

    How about with IO::Socket?

    I'm trying to determine if there is a bug in my code, or if this is
    known behavior.

    Any good solutions?

    Would IO::Select on the file-handle's in the reader's suffice to keep
    the file-handle's clear for the writers to succeed?

    Or will that fail too (if IO::Select somehow locks a file-handle).

    Would Socket work better than IO::Socket without doing a select?

    Regards,
    Steve D
     
    Steve D, Sep 4, 2003
    #1
    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. dmoore
    Replies:
    8
    Views:
    558
    Nick Craig-Wood
    Jun 10, 2007
  2. Laszlo Nagy
    Replies:
    1
    Views:
    5,019
    Mark Wooding
    Jan 27, 2009
  3. Piotr Jakubowski

    Threads and simultaneous read and write

    Piotr Jakubowski, Jan 14, 2011, in forum: C++
    Replies:
    2
    Views:
    502
    Joshua Maurice
    Jan 14, 2011
  4. Novice Coder
    Replies:
    27
    Views:
    663
    BCFD36
    Jan 14, 2012
  5. Replies:
    19
    Views:
    1,362
    Nigel Wade
    Mar 15, 2012
Loading...

Share This Page