Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IO::Socket::INET sender receiver prob (testing local)

Status
Not open for further replies.

GeniuS22

MIS
May 25, 2002
29
CA
Im having problem with this
the error is on the receiver
cannot print sockets
&quot;Use of uninitialized value in print at D:\re.pl line 18, <GEN1> line 1.&quot;

please help me


#!perl -w
# sender
use IO::Socket;
&comunicate;
sub comunicate {
print &quot;Mes :&quot;;
my $message = <STDIN>;
chomp $message;
my $sock = new IO::Socket::INET (
PeerAddr => 'localhost',
PeerPort => '7070',
Proto => 'tcp',
);
die &quot;Could not create socket: $!\n&quot; unless $sock;
print $sock &quot;$message\n&quot;;
close($sock);
&comunicate;
}
# note has to be broken
# end sender
#!perl -w
# receiver
use IO::Socket;

my $sock = new IO::Socket::INET (
LocalHost => 'localhost',
LocalPort => '7070',
Proto => 'tcp',
Listen => 1,
Reuse => 1,
);

die &quot;Could not create socket: $!\n&quot; unless $sock;

my $new_sock = $sock->accept();

while(defined(<$new_sock>)) {
print $_;
}

close($sock); Knowledge is the first step to Greatness!!!
 
never mind found it Knowledge is the first step to Greatness!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top