Windows:
C:/users/ewanbao>netstat-aon|findstr "123"
TCP 127.0.0.1:55123 0.0.0.0:0 LISTENING 5092
TCP 127.0.0.1:55123 127.0.0.1:55124 established 5092
TCP 127.0.0.1:55124 127.0.0.1:55123 established 5092
UDP 0.0.0.0:123 *:* 1416
UDP [::]:123 *:* 1416
[note]: After executing netstat-aon|findstr "123", you can see 5092 process TCP Open 123 port, 1416 process open UDP123 port
C:/users/ewanbao>tasklist|findstr "1416"
Svchost.exe 1416 Services 0 13,540 K
[note]: After executing tasklist|findstr "1416" you can see that Svchost.exe is open on UDP 123 port
Linux:
cba001:~ # lsof-i:5300
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
Named 26751 root 20u IPv4 64750499 TCP LOCALHOST:HACL-HB (LISTEN)
Named 26751 root 21u IPv4 64750501 TCP CBA001.EAPAC:HACL-HB (LISTEN)
Named 26751 root 22u IPv4 64750503 TCP 192.168.0.10:HACL-HB (LISTEN)
Named 26751 root 512u IPv4 64750498 UDP LOCALHOST:HACL-HB
Named 26751 root 513u IPv4 64750500 UDP CBA001.EAPAC:HACL-HB
Named 26751 root 514u IPv4 64750502 UDP 192.168.0.10:HACL-HB
[note]: After executing lsof-i:5300, you can see that the 26751 process has 5300 ports open on both TCP and UDP.
cba001:~ # Ps-ef|grep 26751
Root 10118 26915 0 12:59 pts/8 00:00:00 grep 26751
Root 26751 1 0 Jul06? 00:02:06/opt/ipworks/ipwdns/usr/bin/named
[note]: After executing ps-ef|grep 26751, you can see that the named process has opened 5300 ports
How Windows and Linux see which process occupies the port