Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: TCP Socket and TIME_WAIT

by Khen1950fx (Canon)
on Aug 28, 2012 at 00:07 UTC ( #990094=note: print w/replies, xml ) Need Help??

in reply to TCP Socket and TIME_WAIT

Your use of the bareword SOCKET should be my $socket. Don't forget to declare your subs.
#!/usr/bin/perl BEGIN { $| = 1; $^W = 1; } use strict; use warnings; use Socket qw/PF_INET SOCK_STREAM inet_aton sockaddr_in/; my $port = shift; my $proto = getprotobyname('tcp'); my $iaddr = inet_aton(''); my $paddr = sockaddr_in( $port, $iaddr ); socket( my $socket, PF_INET, SOCK_STREAM, $proto ) || die "Cannot prepare socket: $!"; eval { die "Can't connect to $port" unless connect( my $socket, $paddr ); }; shutdown($socket, 2); sleep 1; exit 0;

Replies are listed 'Best First'.
Re^2: TCP Socket and TIME_WAIT
by Deus Ex (Scribe) on Aug 28, 2012 at 06:34 UTC

    Wonderful! That's what I was looking for!

    Many thanks!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990094]
[marto]: I think that actually caught up with me yesterday, felt a really sharp pain where my neck meets my skull.
[Corion]: marto: Ouch, yeah...
[marto]: the boys uncle will take them for a couple of hours this afternoon :)
[marto]: only at work 3 days this week, then off to Copenhagen for a wedding
[marto]: back the following Monday, potentially gone 2-3 days the next week for work

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2017-11-19 11:35 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (280 votes). Check out past polls.