Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Bidirectional Socket, Blocking

by BrowserUk (Pope)
on Oct 13, 2012 at 20:48 UTC ( #998873=note: print w/ replies, xml ) Need Help??


in reply to Bidirectional Socket, Blocking

You cannot send to a socket whilst the same end that you are trying to send to is in a receive state. Even if the receive is being done on a dup() of the socket in a fork or thread.

Most of the time, that isn't a problem because comms protocols tend to be a conversation where one end speaks and the other replies. If you need to be able to initiate sends from both ends, then your reads will need to be non-blocking.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


Comment on Re: Bidirectional Socket, Blocking
Re^2: Bidirectional Socket, Blocking
by DanielPHuber (Initiate) on Oct 16, 2012 at 13:33 UTC
    Hi Uk, thank's for the replay. I tried all sort of ways using unblocking reads, but to no avail. I could not get a real satisfactory bidirectional communication. If you know an example where this works, I would be gratful. I now resort to a rather clumsy way, by opening two ports, using one to send, the other to receive. This works, but it does not seem to be too clever and if there is a better way, I am happy to engulf it. cheers, Daniel
      I tried all sort of ways using unblocking reads, but to no avail.

      If you posted one of your attempts, we may be able to sort that out for you.

      If you know an example where this works,

      The classic method of performing non-blocking IO is to use select. For examples, scan a few of these hits site:perlmonks.org IO::Socket IO::Select.

      I now resort to a rather clumsy way, by opening two ports, using one to send, the other to receive. This works, but it does not seem to be too clever

      If it is good enough for the FTP-family of protocols, it is good enough for me.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

        Hi Neil,

        not even the examples from:

        http://www.perlmonks.org/bare/?node_id=437028

        work. Could it be that it has something to do with Windows?

        cheers, Daniel

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2014-04-17 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (437 votes), past polls