Google Answers Logo
View Question
 
Q: Does an open socket use network bandwidth? ( Answered,   1 Comment )
Question  
Subject: Does an open socket use network bandwidth?
Category: Computers > Internet
Asked by: puma99-ga
List Price: $5.00
Posted: 01 Apr 2005 03:25 PST
Expires: 01 May 2005 04:25 PDT
Question ID: 503533
Hi,

If I have an application that keeps a socket open to a server, but is
not sending or receiving data, does this still use some network
bandwidth? If so, how much?

I'm wondering if there is any overhead in just keeping the socket
open, with both ends knowing that the connection is still there...
does this use any network traffic for heartbeats or something like
that?

The reason I'm interested is that I want to keep a connection open to
a mobile GPRS device where I have to pay by the amount of bandwidth I
use. I'd rather not continually open and close the sockets, as this
will have an overhead itself. So I'm hoping that the overhead for an
unused socket is fairly low.

thanks,
Richard
Answer  
Subject: Re: Does an open socket use network bandwidth?
Answered By: efn-ga on 10 Apr 2005 20:12 PDT
 
Hi Richard,

According to the UNIX Socket FAQ on UNIXguide.net, "by default, no
packets are sent on the TCP connection unless there is data to send or
acknowledge."  This has been true in my experience too.

http://www.unixguide.net/network/socketfaq/2.8.shtml

As the FAQ answer explains, there is a socket option SO_KEEPALIVE,
which, if turned on, will generate heartbeat packets.  There's another
answer on this option.

http://www.unixguide.net/network/socketfaq/4.7.shtml

Although sockets implementations typically work this way, I don't
think it is guaranteed by any standard, so it would be safest to test
this with your software in your environment, as crythias suggested. 
With a good monitoring tool, you should be able to monitor just your
one connection and not have to discount network traffic from other
processes.  Note that you may have to wait two hours or more to see a
packet generated by the SO_KEEPALIVE option.

I hope this is a satisfactory answer to your qestion.  If you need any
more information, please ask for a clarification.

--efn
Comments  
Subject: Re: Does an open socket use network bandwidth?
From: crythias-ga on 01 Apr 2005 13:18 PST
 
I can't see how an open socket *itself* can create any traffic. Of
course, the easy way to determine it is simply to watch the traffic on
your network card. In windows, open "My Network Places/Network
Neighborhood" and double-click on the network adapter icon that
represents the host adapter that may be listening for your open
socket. It's probably sitting there, dribbling small amounts of
traffic as it is. Then start your server application. Note if there is
any major increase in traffic as the server app listens without
connection.

See, an SMTP server has open port 25 all the time. But, unless traffic
attempts to come into port 25, there really isn't anything to report.
The SMTP server doesn't try to send any traffic unless there is mail
to send.

What *may* cause some network traffic is if things like RPC locator or
a dhcp client is running on your WAN network. A firewall program can
help monitor and lock down some unnecessary traffic.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy