I have a program which creates a tcp socket and binds on to the port 5819.
The expected behaviour is it needs to bind to 5819 using the provided ip.
Due to some malfunction ( which i need to trace ) after bind instead of provided ip it is taking some other ip.
when i do a netstat it shows me like below
tcp 0 0 255.255.255.255:5819 0.0.0.0:* LISTEN
Do i have any system call which i can use in my program where i can check like on this port which ip is being bind .
I thought i can use netstat like executing with system command and then output to a textfile . Now parse the text file to know the result . But it is very expensive as lot of file opertaion and then parsing .
So Any system call or any function through which i can get that info ?
I hope iam making some sense if not please let me know to explain with more workds.