$ strace nc -l -p 4000
...
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sin_family=AF_INET, sin_port=htons(4000),
sin_addr=inet_addr("0.0.0.0")}}, 16) = 0
listen(3, 1) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, {SIG_DFL}, 8) = 0
alarm(0) = 0
accept(3,
# strace -f /usr/sbin/ftpd -s -p 2121 # strace ftp localhost 2121
# strace -f nc -u -l -p 4000
...
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sin_family=AF_INET, sin_port=htons(4000), sin_addr=inet_addr("0.0.0.0")}}, 16) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, {SIG_DFL}, 8) = 0
alarm(0) = 0
recvfrom(3, ...
... {sin_family=AF_INET, sin_port=htons(4000),
sin_addr=inet_addr("127.0.0.1")}}, [16]) = 0
select(16, [0 3], NULL, NULL, NULL) = 1 (in [3])
read(3, "\n", 8192) = 1
write(1, "\n", 1) = 1
...
# strace nc -u localhost 4000
socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, {SIG_DFL}, 8) = 0
alarm(0) = 0
connect(3, {sin_family=AF_INET, sin_port=htons(4000),
sin_addr=inet_addr("127.0.0.1")}}, 16) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, {SIG_IGN}, 8) = 0
alarm(0) = 0
select(16, [0 3], NULL, NULL, NULL) = 1 (in [0])
read(0, "\n", 8192) = 1
write(3, "\n", 1) = 1
...
# # <service_name> <sock_type> <proto> <flags> <user> <server_path> <args> # #:INTERNAL: Internal services # echo stream tcp nowait root internal echo dgram udp wait root internal chargen stream tcp nowait root internal chargen dgram udp wait root internal discard stream tcp nowait root internal discard dgram udp wait root internal daytime stream tcp nowait root internal daytime dgram udp wait root internal time stream tcp nowait root internal time dgram udp wait root internal #:STANDARD: These are standard services. # telnet stream tcp nowait telnetd.telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/wu-ftpd -l telnet stream tcp nowait telnetd.telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd #:BSD: Shell, login, exec and talk are BSD protocols. # shell stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.rshd login stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.rlogind exec stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.rexecd talk dgram udp wait root.tty /usr/sbin/tcpd /usr/sbin/kotalkd ntalk dgram udp wait root.tty /usr/sbin/tcpd /usr/sbin/ktalkd