I found this answer to be useful: Getting PID of peer socket on Windows .. but also intriguing.
I'm wondering: why are there 16 bits masked in row->dwLocalPort & 0xFFFF
out of the 32 DWORD bits in dwLocalPort?
I know that bitmasks are used to add more information into 1 number, but it seems for me that here it is not necessary. Am I overlooking something simple?
As per MSDN "The maximum size of an IP port number is 16 bits, so only the lower 16 bits should be used. The upper 16 bits may contain uninitialized data."
https://msdn.microsoft.com/en-ca/subscriptions/bb485761.aspx