ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi Guys,
I'm doing an implementation of T/TCP on Linux and need a bit of help here. I need to actually find out the state of the connection ; as per the actual TCP state transition diagram .So for example I need to find out how exactly to tell whether the state of the connection is SYN_SENT or CLOSING or LASTACK..etc etc . The code for this is in the kernel if I'm not mistaken ; correct me if I'm wrong . So is there any way ( API's etc ) which I can use if I want to find out the state of the client/server or do I actually have to play around with kernel modules. This is because I need to build customized T/TCP packets and a certain packet can be sent only if the client is in a particular state . If I'm not clear and anyone needs more information please do let me know .Appreciate any help .
Thanks a lot
Arvind.
Not really guys..netstat does give me the states no doubt ; thats exactly what I want but I just want to know how to find the states of processes programatically ; through a piece of code without manually doing a netstat . For example ; I code a simple client - server application and there are some processes running ; some of which are in Listen , some in closing and some in established . If I do a netstat and list those processes I can see that the processes are in those states . All I need here is to write some code which I can use to actually get the states of those processes and use those states to create my packets .Hope this clarifies things a little.
Thnx
Arvind
according to strace, my netstat seems to get its information from /proc/net/tcp (and analagous files for other protocols). You can probably get the format of that file by googling around. or looking at netstat's source.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.