Re: TCP connection count
Re: TCP connection count
- Subject: Re: TCP connection count
- From: "Peter Sichel" <email@hidden>
- Date: Wed, 10 Oct 2007 14:00:23 -0400
On 10/10/07, Eyal Redler wrote:
>Thanks for the answer, Peter. I'm currently porting a networking
>intensive windows application and I simply need to implement a call
>that does exactly what I've described, it could be that it not the
>best way or even a good way to check the internet connection and
>maybe this will change in the future but at the moment, I really need
>to know if this is possible (counting TCP connections) or not.
>
>Any ideas how this could be done?
You can count TCP connections using Sysctl to get a list of
TCP connection control blocks using MIB name CTL_NET, AF_INET,
IPPROTO_TCP, TCPCTL_PCBLIST. You can read more about this in
Steven's UNIX Network Programming. I use this in the Connection
List tool in IPNetMonitorX.
Alternatively, you might use UNIX lsof to get information on open
network sockets.
Apple has a "Reachibility API" that was originally conceived
to determine if attempting some internet access is likely to
succeed, or will cause the modem to dial out (which is often
undesirable).
Having a connection doesn't mean it is actually responsive.
If you want to determine whether the Internet is responding,
pinging to your name server and/or some other well known
server might be a reasonable test.
I hope this helps,
- Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden