Hi all,

I am writing a socket script so I can pull a log file thru a web page. For right now, 
Im just trying to get it to work from a shell. I have gotten it to where the client 
sends information to the server, but this should work the other way. When I try to get 
the server to write to the client, I get a broken pipe error. Below is the code for 
the server program:

#!/usr/bin/perl -w
# serIO.pl
# server using IO::Socket
#------------------------

use strict;
use IO::Socket;
use Shell qw(tail);

my $sock = new IO::Socket::INET(
        LocalHost => 'druidia.netlogic.net',
        LocalPort => 7890,
        Proto     => 'tcp',
        Listen    => SOMAXCONN,
        Reuse     => 1);


$sock or die "no socket :$!";
my($new_sock, $c_addr, $buf);

while (($new_sock, $c_addr) = $sock->accept())
{
 my ($client_port, $c_ip) =sockaddr_in($c_addr);
 my $client_ipnum = inet_ntoa($c_ip);
 my $client_host =gethostbyaddr($c_ip, AF_INET);

# This is what it will do eventually
# print $sock tail("-75 /var/log/radius.log");

# Just for testing purposes
print $sock "TEST";

 while (defined ($buf = <$new_sock>))
 {
  print $buf;
 }
}

Any help is appreciated, I have tried debugging it, and it 'dies' at the 'print $sock 
"TEST";' line. I am still learning perl, and copied most of this from various 
tutorials on sockets. 

TIA,

Dave Kettmann
NetLogic
636-561-0680

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to