I'm attempting to use a perl script to interface with my Visual Basic 6
program using Winsock. I've got my program setup to connect and works
great if i connect to another winsock program, but it acts funny
connecting to my perl script. The Perl code is below:
#!c:/Perl/bin/Perl.exe
use IO::Socket;
$server = IO::Socket::INE T->new(LocalAdd r => '10.40.0.10',
LocalPort => '8777',
Proto => 'tcp',
Listen => 1,
Reuse => 1);
die "ERROR: $!\n" unless $server;
print "Waiting on connections...\ n";
while($client = $server->accept()){
print "Connection made, reading data...\n";
print <$client>;
print "Connection closed...\n";
}
$server->close();
All the program is supposed to do is open a socket on port 8777 for tcp.
Listen for any incomming connections then read the one line of data
comming in. I've read on the internet and in my perl in a nutshell book
that the above code should work. But they all say the same thing. You
must get the line of data and scan it for a character that lets the perl
script that the line is done. Problem is, when the script runs, i get as
far a connection made then it will do nothing until i close the VB Winsock.
Anyone got a reader for sockets that will know when to stop reading? I
haven't found any examples on the internet on how to do it, just that
everyone says it can be done. I'd really appreciate the help!
Daniel Moree
program using Winsock. I've got my program setup to connect and works
great if i connect to another winsock program, but it acts funny
connecting to my perl script. The Perl code is below:
#!c:/Perl/bin/Perl.exe
use IO::Socket;
$server = IO::Socket::INE T->new(LocalAdd r => '10.40.0.10',
LocalPort => '8777',
Proto => 'tcp',
Listen => 1,
Reuse => 1);
die "ERROR: $!\n" unless $server;
print "Waiting on connections...\ n";
while($client = $server->accept()){
print "Connection made, reading data...\n";
print <$client>;
print "Connection closed...\n";
}
$server->close();
All the program is supposed to do is open a socket on port 8777 for tcp.
Listen for any incomming connections then read the one line of data
comming in. I've read on the internet and in my perl in a nutshell book
that the above code should work. But they all say the same thing. You
must get the line of data and scan it for a character that lets the perl
script that the line is done. Problem is, when the script runs, i get as
far a connection made then it will do nothing until i close the VB Winsock.
Anyone got a reader for sockets that will know when to stop reading? I
haven't found any examples on the internet on how to do it, just that
everyone says it can be done. I'd really appreciate the help!
Daniel Moree
Comment