how to specify which port to use using INET in perl

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2010-04-29T01:36:11Z Indexed on 2010/04/29 1:47 UTC
Read the original article Hit count: 385

Filed under:
|

Hi:

I am using perl INET to create inter-process communication in my program. I need to use a specific port number in my TCP client. I was following the example in Perl doc, but it doesn't work. Here is my code:

old code(working):

tx_socket = new IO::Socket::INET->new('127.0.0.1:8001') || die "Can't connect to 127.0.0.1:8001 : $!\n";

new code(not working):

tx_socket = new IO::Socket::INET->new('127.0.0.1:8001', LocalPort=>9000 ) || die "Can't connect to 127.0.0.1:8001 : $!\n";

Does anyone know what's wrong?

Thanks

© Stack Overflow or respective owner

Related posts about perl

Related posts about inet