Thread: Sockets
View Single Post
Old Dec 2nd, 2005, 10:20 PM   #1
ProjectX
Programmer
 
ProjectX's Avatar
 
Join Date: Feb 2005
Posts: 37
Rep Power: 0 ProjectX is on a distinguished road
Sockets

Hey guys its me again. Sorry if I am getting annoying with all the post i did but I need help.So I started to practice with sockets so i made a script that opens a port and listens on it.

#!C:/PERL/BIN/perl.exe -w
#
use IO::Socket;
my $sock = new IO::Socket::INET (LocalHost => '192.168.1.100',
                                 LocalPort => '1337',
                                 Proto => 'tcp',
                                 Listen => 1,
                                 Reuse => 1,);
die "Could not create socket: $!\n" unless $sock;
my $newsock = $sock -> accept();
while (defined(<newsock>)) {
      print $_;
}
close($sock);

and it gives me this error:
Name "main::newsock" used only once: possible typo at C:\DOCUME~1\User\MYDOCU~1\PERLPR~1\Sockets\Socket~1.PL line 11.
and I dont know how to fix it.
ProjectX is offline   Reply With Quote