Socket isn't listed by netstat unless using certain ports
Posted
by illuzive
on Stack Overflow
See other posts from Stack Overflow
or by illuzive
Published on 2010-05-25T12:07:24Z
Indexed on
2010/05/25
12:11 UTC
Read the original article
Hit count: 251
I'm a computer science student with a few years of programming experience. Yesterday, while working on a project (Mac OS X, BSD sockets) at school, I encountered a strange problem.
I was adding several modules to a very basic "server" (mostly a bunch of functions to set up and manage an UDP socket on a certain port). While doing this, I started the server from time to time in order to see that everything worked like it should.
I've been using port 32000 during the development of the server. When I start the server and run netstat, the socket is listed as expected.
> netstat -p UDP | grep 32000
udp46 0 0 *.32000 *.*
However, when I run the server on other ports (random (10000 - 50000)), it's not listed by netstat. My thought was that I had somehow hard coded the port somewhere in the code, but that's not the case.
The thing is - I can connect to the socket on any of the tested ports, and it reads data sent to it without any problem at all. It just doesn't get listed by netstat.
What I wonder, is if anyone of you have any idea of why this happens?
Note: Although this is a project at school, it's not homework. This is just something I want to understand for my own benefit.
© Stack Overflow or respective owner