Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inetd.conf and tcpd question

Status
Not open for further replies.

cag27

Programmer
Mar 1, 2001
9
US
I am in the process of writing a Linux server program (written in Perl) which makes 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)

When I checked 'netstat', I saw mrpt listed in the LISTEN state, but I cannot get my client-side program to connect to the mrpt service. How would I invoke the mrpt service so that it will accept a client-side connection?

Thank you,
Carrie

 
Try without wrapping it with tcpd: I do not
believe that either your perl script and tcpd
are compatible..you would have to use the
filter logic of tcpd to have your script be tcpd aware and vice versa. I could be wrong
though..i never have tried running a script
through tcp wrappers..

Litmus test:

perlsockapp stream tcp nowait user \ /path/to/app app -args

Good Luck
 
Hi,

You can make a perl script compatible with tcp wrappers via Authen::Libwrap --> . See also Config::Access --> .

Otherwise, you'd just leave out the 'tcpd' bit to run the code without tcp wrappers..

mrpt stream tcp nowait root /solid/socket.pl

All inetd/xinetd do really is load/unload servers on demand, i.e. when certain ip traffic is received. The code itself is the same as running it directly.

Rgds
 
Thank you both for your suggestions -- it turns out that I was making this much more difficult than it needed to be. Since inetd has already set up the server to listen on an assigned port, and tcpd checks all potential clients that try to connect with that server, all I had to do was add this code to my socket.pl script:

$i = 0;

open (FILE, "+> /mypath/data/file.$$") || die;

while (<>) {
$i++;
print FILE &quot;$i => $_\n&quot;;
}

close FILE;

and then fire up my client-side program and let it transmit the data to the server. My mistake was in using &quot;read&quot; on the server side to collect data from the client -- the connection was hung up in a CLOSE_WAIT state while waiting for the read buffer to fill up, which of course it never did.

Thanks,
Carrie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top