Basically what you're going to do is write a program that reads in IP numbers 
from standard input and prints out a hostname associated with it to standard 
output (you could do it within the MUD, as in not in a separate program, but 
the memory footprint of the mud is really pretty large for such a simple 
function).
You'll need to work out some format to send and receive this information that 
can be parsed into usable information.
Use the pipe(2) function to get file handles for talking between the two 
processes.
fork(2)
Use dup2(2) to copy the pipe's descriptors to standard input and output of the 
child process.
exec the IP resolving program in the child process.
Write the IPs of incoming users to the pipe.
Put the read end of the pipe into the MUD's select statement, so you know when 
it's trying to send back data.
ta da!

Ok it's not entirely easy if you're not into systems programming... but it'll 
work really good once it gets going.

--Palrich.

On Tuesday 14 May 2002 11:38 am, JF Bethlehem wrote:
> ok, this sounds interesting, but i have almost 0 experience with forking
> and stuff under linux.
> The threaded nslookup stuff came from a snippet i downloaded (yes,
> occasionally i use snippets,
> esp. when it goes over my head)
> Could you show me some snippet, or tell me how to do this?

Reply via email to