hi,all!
today,i have write such a program
#!usr/local/bin/perl5.6.1
#middle machine version 1.0
use IO::Socket;
$SIG{CHLD} = sub {wait()};
$main_sock = new IO::Socket::INET(LocalHost =>'192.168.1.2',
LocalPort => 34561,
Listen => 5,
Proto => 'tcp',
Reuse => 1,
);
die "main Socket could not be created.Reason: $!\n" unless ($main_sock);
while ($new_sock = $main_sock->accept()){
$pid = fork();
die "Cannot fork : $!" unless defined ($pid);
if ($pid ==0){
while (defined ($buf = <$new_sock>)){
print $buf;
send_message();}
exit(0);
}
}
close ($main_sock);
sub send_message{
$send_sock = new IO::Socket::INET(PeerAddr =>'192.168.1.3',
PeerPort =>34562,
Proto =>'tcp'
);
die "Socket Could not be created.Reason:$!\n" unless $send_sock;
print $send_sock $buf;
$send_sock ->flush();
close ($send_sock);
}
the problem is the socket $send_sock could not establish with the host
192.168.1.3 while i run this program
the hos 192.168.1.3 just a simple program to recieve the message from this
program.
how to resolve this problem,please help me ,thanks!!! :-)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]