NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
dhcpd dup my socket?
I wrote a program foo, do below two steps:
1) create a pthread, listen on tcp port 38001,
# sockstat -n | grep 38001
root foo 20060 4 tcp *.38001 *.*
2) call system("/etc/rc.d/dhcpd restart");
# sockstat -n | grep 38001
root dhcpd 15187 4 tcp *.38001 *.*
root foo 20060 4 tcp *.38001 *.*
now:
# pkill foo
# sockstat -n | grep 38001
root dhcpd 15187 4 tcp *.38001 *.*
then use telnet on another machine:
$ telnet 61.144.174.157 38001
Trying 61.144.174.157...
Connected to 157.174.144.61.broad.sz.gd.dynamic.163data.com.cn.
Escape character is '^]'.
and then
# /etc/rc.d/dhcpd restart
$ telnet 61.144.174.157 38001
Trying 61.144.174.157...
telnet: Unable to connect to remote host: Connection refused
I think system("/etc/rc.d/dhcpd restart"); is the root issue.
So how to resolve it?
Thanks.
Home |
Main Index |
Thread Index |
Old Index