S
Suk
Hi
Im new to perl socket programming.
I have a server program on a certain machine which simply cat's a file
when it receives a connection to port 10000 . This is done via inetd on
a Solaris system as follows:
Line in /etc/inetd.conf:
# Test program
test stream tcp nowait root /usr/bin/test1
Line from /etc/services:
# Test program on port 10000
test 10001/tcp
The script /usr/bin/test1 simply contains a single line to cat a
certain text file, so if you telnet to port 10000 you simply get the
contents of the file.
I want to write a very simple perl script to connect to this server and
receive the data into $data
Problem is that the contents of the file can be very large (>300K) and
i dont seem to be getting all the data into $data
Im doing something like this:
our $sock = new IO::Socket::INET ( PeerAddr => $MESSAGE_SERVER,
PeerPort => $TARGET_PORT, Proto => 'tcp',);
And then receiving the data like this:
recv($sock,$data,3000,0);
$data doesnt contain everything though.
Like I say, i've never really done any socket programming before, so if
if someone knows the correct way of receiving data then that woulbe be
appreciated.
Im new to perl socket programming.
I have a server program on a certain machine which simply cat's a file
when it receives a connection to port 10000 . This is done via inetd on
a Solaris system as follows:
Line in /etc/inetd.conf:
# Test program
test stream tcp nowait root /usr/bin/test1
Line from /etc/services:
# Test program on port 10000
test 10001/tcp
The script /usr/bin/test1 simply contains a single line to cat a
certain text file, so if you telnet to port 10000 you simply get the
contents of the file.
I want to write a very simple perl script to connect to this server and
receive the data into $data
Problem is that the contents of the file can be very large (>300K) and
i dont seem to be getting all the data into $data
Im doing something like this:
our $sock = new IO::Socket::INET ( PeerAddr => $MESSAGE_SERVER,
PeerPort => $TARGET_PORT, Proto => 'tcp',);
And then receiving the data like this:
recv($sock,$data,3000,0);
$data doesnt contain everything though.
Like I say, i've never really done any socket programming before, so if
if someone knows the correct way of receiving data then that woulbe be
appreciated.