Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Sockets and threads, oh my!

by KevinZwack (Chaplain)
on Jun 19, 2006 at 21:07 UTC ( #556295=note: print w/ replies, xml ) Need Help??


in reply to Re: Sockets and threads, oh my!
in thread Sockets and threads, oh my!

I tried your modified code, but it still seems the function the same as before. I'm confused too, aren't sockets supposed to be full-duplex?

Unfortunately the motherboard on my laptop fried yesterday, so I won't be able to due further testing on Windows. I can continue development on my Solaris workstation for the next few weeks.

Regards,
Kevin Zwack


Comment on Re^2: Sockets and threads, oh my!
Re^3: Sockets and threads, oh my!
by BrowserUk (Pope) on Jun 19, 2006 at 21:44 UTC

    I can assure you that the code I posted works using AS811/AS817 under XP.

    As for the "full-duplex" thing, that is a confusing term when applied to communications over tcp connections. Both ends can transmit simultaneuosly because the buffering and handshaking (ack & nacks) are taken care of at the ip level. Whether one end can both send and receive simultaneously on different threads really depends upon the implementation.

    What I can tell you is that under XP, if the socket is in blocking mode, attempts to send and receive are serialised by the runtime. Ie. If one thread is currently in a blocking read, no other thread will be able to send until the read is satisfied or it times out. In non-blocking mode, the same is true, but if you use sysread, it will only fetch however much is currently available at the interface and return immediately. Even if nothing is available. The error code I mention in the code indicates that an incomplete read has returned early.

    Whether sockets operate this way on other platforms I do not know.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      That's strange, I copied and pasted your new code but still had the problem. I'll try again in a few weeks, I'm waiting for a new motherboard for my laptop. Thanks again for all your help.

      Regards,
      Kevin Zwack

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2014-10-24 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (132 votes), past polls