mjmjmj has asked for the wisdom of the Perl Monks concerning the following question:

hi guys sorry me for my poor english

i have a perl source code that work

my $host=$_[0]; my $sock = new IO::Socket::INET(PeerAddr=>$host,PeerPort=>'27015',Prot +o=>'udp'); die "Could not create socket: $!\n" unless $sock;
now i whant add LocalPort to this code taht specify the source port what i must to do? i change that to this but get erorr
my $host=$_[0]; my $sock = new IO::Socket::INET(PeerAddr=>$host,PeerPort=>'27015',Prot +o=>'udp',LocalPort=>'27005'); die "Could not create socket: $!\n" unless $sock;

Code tags added by Arunbear

Replies are listed 'Best First'.
Re: Socket Problem
by ahmad (Hermit) on Mar 26, 2006 at 21:19 UTC

    what do you want to do exactly ?

    you want to make a server or a client ?

    LocalPort used to specifiy the LocalPort you want to open on your computer to deal with incomming connections as a SERVER

    HTH

Re: Socket Problem
by mikeock (Hermit) on Mar 26, 2006 at 19:23 UTC
    What does the program spit out when you run it? All I see is the code twice..

    The reason that I say this is $! should translate to an actual message of what the error is.

    Also, Look at properly formatting your questions with the appropriate code tags and such and you will get a much faster response.