I have always wondered why automatically assigned ports in BSD sockets range from 1024 to 5000... can anyone tell me why is this?
I have always wondered why automatically assigned ports in BSD sockets range from 1024 to 5000... can anyone tell me why is this?
http://www.iana.org/assignments/port-numbers
0 to 1023 are reserved.
Your OS probably treats the range you observe as a pool of ports to use, so it picks the next free one in that range.
This isn't a C question, moved.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.