16
Strictly speaking, you could try performing an operation on the socket which would incidentally determine what type of socket it is, like trying to accept a connection from it. If accept() fails with EINVAL, that's a pretty good sign that it isn't listening. :)
Keeping track of which sockets are which is a better solution overall, though. Unless you're building a really trivial application, chances are that you'll need to keep some sort of additional data on each socket anyway.