Getting TCP Port status through C API

Does anyone know if there is a C API call to get the status of a TCP port? As opposed to running netstat and parsing the results. At the moment I have to attempt to bind() and pick up on the address in use error which isn't very elegant

Thanks

---------- Post updated at 10:42 AM ---------- Previous update was at 10:39 AM ----------

This is on Solaris 10. Unfortunately not Linux where I could have used the proc filesystem