Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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(""); $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=>"", 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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000757]
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-06-25 05:01 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.