Hi all,
Just having one or two problems writing a little network daemon:
1. Most programs in the inetutils distribution seem to lose their
controlling terminals as follows:
int tty = open( "/dev/tty", O_RDWR );
ioctl( tty, TIOCNOTTY );
close( tty );
All of the function calls proceed successfully, but the program stays in
the foreground. The alternative of fork()ing seems kinda like cheating.
Any ideas?
2. I want the program to listen on a given port on all network
interfaces. Programs running under inetd do this, but my program is
standalone.
Other standalone daemons seem to do this. Obviously when one binds to a
local address, it only listens on the interface to which that address
belongs, eg if i bind with the address 127.0.0.1, then my program won't
listen on my ethernet card's address.
Thanks in advance,
William Murphy
<alias at student.nuigalway.ie>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!