My question encompasses quite a few different forums, but since I'm having problems with Perl on a Red Hat Linux machine, I'll try here first.
Basically, I have a Linux server program (written in Perl)making a socket connection with a Windows NT client program (written in Visual Basic). Once the client connects to the server, the client passes information read from a file through the socket connection to the server.
When I originally wrote the code for the server, I specifically created the server socket, accepted the client connection, and used "recv" to get data from the client (using the IO::Socket and Net::hostent modules) -- that worked fine. Now, I need to use inetd on the server side to complete the steps I had previously specifically coded, and I am not receiving data through the socket connection.
hosts.allow and hosts.deny are fine, and I added the following line to inetd.conf:
mrpt stream tcp nowait root /usr/sbin/tcpd /solid/socket.pl
and the following line was added to /etc/services:
mrpt port #/tcp (where 'port #' is the actual numeric
port number)
I have spent the last two days searching for information on inetd, and I can not figure out what is preventing the client data from making it over to the server. I do think the roadblock has to do with how data is received (or in this case, not received) on the server side. In my original version (non-inetd) I used the following code:
....
use IO::Socket;
use Net::hostent;
#length of the input buffer
my $buffer = 10000;
#line read from the client
my $array_list = "";
....
#create a new socket
my $sock = new IO::Socket::INET(
LocalAddr => 'bug',
LocalPort => $PORT,
Proto => 'tcp',
Listen => 5,
Reuse => 1
);
#output an error message if socket could not be created
die "Could not create socket: $!\n" unless $sock;
#accept a connection to the socket
my $new_sock = $sock->accept(0);
....
while( defined(<$new_sock>) )
{
recv($new_sock, $array_list, $buffer, 0);
....
}
....
close($sock);
How would I convert this code for use with the inetd configuration? Any suggestions would be greatly appreciated.
Thank you,
Carrie
Basically, I have a Linux server program (written in Perl)making a socket connection with a Windows NT client program (written in Visual Basic). Once the client connects to the server, the client passes information read from a file through the socket connection to the server.
When I originally wrote the code for the server, I specifically created the server socket, accepted the client connection, and used "recv" to get data from the client (using the IO::Socket and Net::hostent modules) -- that worked fine. Now, I need to use inetd on the server side to complete the steps I had previously specifically coded, and I am not receiving data through the socket connection.
hosts.allow and hosts.deny are fine, and I added the following line to inetd.conf:
mrpt stream tcp nowait root /usr/sbin/tcpd /solid/socket.pl
and the following line was added to /etc/services:
mrpt port #/tcp (where 'port #' is the actual numeric
port number)
I have spent the last two days searching for information on inetd, and I can not figure out what is preventing the client data from making it over to the server. I do think the roadblock has to do with how data is received (or in this case, not received) on the server side. In my original version (non-inetd) I used the following code:
....
use IO::Socket;
use Net::hostent;
#length of the input buffer
my $buffer = 10000;
#line read from the client
my $array_list = "";
....
#create a new socket
my $sock = new IO::Socket::INET(
LocalAddr => 'bug',
LocalPort => $PORT,
Proto => 'tcp',
Listen => 5,
Reuse => 1
);
#output an error message if socket could not be created
die "Could not create socket: $!\n" unless $sock;
#accept a connection to the socket
my $new_sock = $sock->accept(0);
....
while( defined(<$new_sock>) )
{
recv($new_sock, $array_list, $buffer, 0);
....
}
....
close($sock);
How would I convert this code for use with the inetd configuration? Any suggestions would be greatly appreciated.
Thank you,
Carrie