The next bit of code is the recieving portion of the socket code (server)#!/usr/bin/perl use strict; use IO::Socket; my $sock = new IO::Socket::INET ( PeerAddr => '10.2.7.193', PeerPort => '7788', Proto => 'tcp', ); die "Could not create socket :-( $!\n" unless $sock; print $sock "hello world!"; close($sock);
When I execute the recieving program on the server machine and then execute the sending program on the cliant machine, I would expect that the cliant would send the text "hello world" to the server machine. I, however, am recieving the following error message instead:#!/usr/bin/perl -w use strict; use IO::Socket; my $sock = new IO::Socket::INET ( LocalHost => '10.2.7.193', LocalPort => '7788', Proto => 'tcp', Listen => 2, Reuse => 1, ); die "Could not create socket: $!\n" unless $sock; my $new_sock = $sock->accept(); while(defined(<$new_sock>)) { my $storage = $_; print $storage; } close($sock);
I am new to socket programming, but do realize that is very powerful. If anyone has any ideas of what might be wrong or any resources that might help me out, I would be very appreciative of your help. Thank you for your time in looking at my problem. Have a nice day :-)Use of uninitialized value in print at ./socket_serv line 17, <GEN1> l +ine 1.
In reply to Perl Sockets Problem by JoeJaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |