C
cerr
Hi There,
I need to write a client that is listening on a certain port and do
sometihng in case there's no data coming.
Now, if I telnet in on port 16010, I see the data coming but my perly
script isn't showing anything, what am I doing wrong?
My code looks like this:
[snip]
my $proto = getprotobyname('tcp');
# get the port address
my $iaddr = inet_aton($host);
my $paddr = sockaddr_in($port, $iaddr);
# create the socket, connect to port
socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect(SOCKET, $paddr) or die "connect: $!";
my $line;
while ($line != ""){
print $line;
}
print $line;
close SOCKET or die "close: $!";
[snip]
Shouldn't that work exactly like this? I don't get no error message or
anything - i don't see a thing...
I need to write a client that is listening on a certain port and do
sometihng in case there's no data coming.
Now, if I telnet in on port 16010, I see the data coming but my perly
script isn't showing anything, what am I doing wrong?
My code looks like this:
[snip]
my $proto = getprotobyname('tcp');
# get the port address
my $iaddr = inet_aton($host);
my $paddr = sockaddr_in($port, $iaddr);
# create the socket, connect to port
socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect(SOCKET, $paddr) or die "connect: $!";
my $line;
while ($line != ""){
print $line;
}
print $line;
close SOCKET or die "close: $!";
[snip]
Shouldn't that work exactly like this? I don't get no error message or
anything - i don't see a thing...