Socket states
Bill Antonia (2466) 130 posts |
I’m trying to write something similar to netstat. I’ve got most of the information needed apart from the last column which would show the status any TCP sockets. Where would I find that information? I’m writing the program in C using the DDE, but finding some things declared in the TCPIPLibs header files not being exported, such as functions in sys/socketvar.h |
Bryan (8467) 468 posts |
Not so sure this will help. But, in the absence of any other replies. Typing INETSTAT, will list the current sockets and show each to be in one of the following states:- State Description CLOSED Indicates that the server has received an ACK signal from the client and the connection is closed CLOSE_WAIT Indicates that the server has received the first FIN signal from the client and the connection is in the process of being closed ESTABLISHED Indicates that the server received the SYN signal from the client and the session is established FIN_WAIT_1 Indicates that the connection is still active but not currently being used FIN_WAIT_2 Indicates that the client just received acknowledgment of the first FIN signal from the server LAST_ACK Indicates that the server is in the process of sending its own FIN signal LISTENING Indicates that the server is ready to accept a connection SYN_RECEIVED Indicates that the server just received a SYN signal from the client SYN_SEND Indicates that this particular connection is open and active TIME_WAIT Indicates that the client recognizes the connection as still active but not currently being used Where you would find that information documented for RISC OS, I do not know, but maybe this reply will prompt somebody else to give you a better reply :) |
Bill Antonia (2466) 130 posts |
Thanks Bryan, that list is useful. However, as you say, where that information is documented I also don’t know. I think some info could be extracted from the status field in the struct socket structure, but accessing that should be easy using the function |
Julie Stamp (8365) 474 posts |
inetstat uses the sysctl call net.inet.tcp.pcblist. I didn’t find it in the man pages – I think it’s a case of looking at the inetstat source. |
Bill Antonia (2466) 130 posts |
Thanks Julie, I’ve been trawling through the sources to see what I can find, thanks for the pointer I’ll have a look there. I was viewing www.riscosopen.org website when I ran my program.
|
Bill Antonia (2466) 130 posts |
Ahhh… Found this trawling through the source code!
So there is an equivalent to netstat, just not documented in my copy of the Issue 1 August 1995 Supplement for version 3.6. Thanks for your help, problem now solved, I don’t need to write my own.
|
Sprow (202) 1158 posts |
In Acorn land there was a pre-existing |