[VPM] socket problem. please help. it's driving me crazy!

Jeremy Aiyadurai jeremygwa at hotmail.com
Fri Jan 9 21:49:11 CST 2004


hi all,

I am wondering if someone can help me with a socket problem.
I can get windows box to talk to a windows box and linux box to talk to a 
linux box.
I am trying to get a linux box and windows box to talk to each other.
But it just wont work, the scripts just stall. I know they connect, but they 
wont talk.
I dont know what I am doing wrong.

Your help will be appreciated.
Thanks in advance.

Jeremy A.

Here is the code for the client and server

----------linux server script---------------------------
$| = 1;
use IO::Socket;





$svr = IO::Socket::INET->new( Proto    => "tcp",
                                 Type     => SOCK_STREAM,
                                 LocalPort => "7777",
                                 Listen => 1,
                                 );



unless ($svr) {
die "cannot connect\r\n";
}


while(1)
{
print "waiting for connect\r\n";
my $cli = $svr->accept();
my $data = <$cli>;
print $data;
chomp($data);
chomp($data);
my @tosend = `$data`;
foreach(@tosend)
{
        print $cli $_;
}


}


-----------------------windows client script-------------------
use IO::Socket;


my $buf,$ibuf;



$remote = IO::Socket::INET->new( Proto    => "tcp",
                                 PeerAddr => '192.168.1.102',
                                 Type     => SOCK_STREAM,
                                 PeerPort => "7777");



unless ($remote) {
die "cannot connect\r\n";
}




print $remote "dir\n";
   while (sysread($remote,$ibuf,1500)) {
      $buf .= $ibuf;
    }
    print "$buf";
close($remote);

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca




More information about the Victoria-pm mailing list