Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: built-in socket functions

by tenny1204 (Novice)
on Oct 25, 2012 at 04:28 UTC ( #1000757=note: print w/ replies, xml ) Need Help??


in reply to Re: built-in socket functions
in thread built-in socket functions

I tried errorchecking but no error, doesn't even seem to matter what i write after pack().I have something like:

$port=80; $proto=getprotobyname('tcp'); socket(SOCKET,AF_INET,SOCK_STREAM,$proto) or die "no socket"; setsockopt(SOCKET,SOL_SOCKET,SO_RCVTIMEO,pack("LL",1,0)); $iadr = inet_aton("127.0.0.1"); $padr=sockaddr_in($port,$iadr); if(connect(SOCKET,$padr)){ print "connection ok";} else{print "$!\n";}

It should correspond to something like:

$conn = IO::Socket::INET->new( PeerAddr=>"127.0.0.1", PeerPort=>80, Proto=>'tcp', Timeout=> 1, Blocking=>1 );

So: a blocking socket with a 1 second timeout because now the standardtimeout is something like 10 seconds,making my applications run slower iso faster which was the general idea.


Comment on Re^2: built-in socket functions
Select or Download Code
Re^3: built-in socket functions
by BrowserUk (Pope) on Oct 25, 2012 at 04:45 UTC

    See Re: how to set socket recv timeout in architecture independent manner?


    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

      I allready looked at that, says on windows SO_RCVTIMEO is considered to be a DWORD, but i cannot find any documentation on how to pack a DWORD, so i keep getting stuck. I thought maybe it would be something simple, cause it doesn't take much effort if you're using the IO::Socket module. But nevermind, I'll work something out. Thank you.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-09-19 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls