LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-28-2005, 11:46 AM   #1
live_dont_exist
Member
 
Registered: Aug 2004
Location: India
Distribution: Redhat 9.0,FC3,FC5,FC10
Posts: 257

Rep: Reputation: 30
to find state connection is in?


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.
 
Old 03-28-2005, 12:42 PM   #2
juanbobo
Member
 
Registered: Mar 2005
Location: Chicago
Distribution: Gentoo AMD64
Posts: 365

Rep: Reputation: 30
I am not quite sure what you are looking for, but ethereal from ethereal.com is a great network analysis program.
 
Old 03-28-2005, 01:27 PM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
netstat gives connection states in the rightmost column. not sure if that's what you want though
 
Old 03-28-2005, 04:04 PM   #4
live_dont_exist
Member
 
Registered: Aug 2004
Location: India
Distribution: Redhat 9.0,FC3,FC5,FC10
Posts: 257

Original Poster
Rep: Reputation: 30
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
 
Old 03-28-2005, 04:11 PM   #5
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see internet connection state icon ? How not to see XP's folders, in Suse9.3 ? tennis SUSE / openSUSE 1 08-14-2005 05:10 AM
Time out in Connection established state if no Data flows on that connection asurya Linux - Networking 2 04-10-2005 03:54 PM
Time out in Connection established state asurya Linux - Newbie 1 04-10-2005 03:48 PM
Network card connection state eeades Slackware 3 02-28-2005 06:13 PM
Help! Can't find host w PPP Connection? NightSky Slackware 4 06-16-2002 05:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration