Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3602632
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:46:14+00:00 2026-05-18T20:46:14+00:00

I’ve set up this simple script on my local machine: #!/usr/bin/python import socket from

  • 0

I’ve set up this simple script on my local machine:

#!/usr/bin/python

import socket
from datetime import datetime

print "Connecting to test server"

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("mydomain.com", 9090))

start = datetime.now()

totalbytes = 0

try:
    while True:
        data = s.recv(512)
        totalbytes += len(data)
        print "Got %d bytes of data" % (len(data))
except Exception as e: 
    print "ERROR", e
    pass

end = datetime.now()

print "Lasted for", end - start, "with a total of", totalbytes/1000/1000, "megabytes"

And this script on my local server (running on the same network, but note that I am going through the external ip-address here)

#!/usr/bin/python

import socket
from datetime import datetime

print "Listening for test client"

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("192.168.2.100", 9090))
s.listen(5)

start = datetime.now()

try:
    while True:
        clientsocket, address = s.accept()

        # Start sending infinite data until I can't
        while True:
            clientsocket.send("*" * 511 + "+")
except:
    pass

end = datetime.now()

print "This lasted", end - start

On to my problem: The connection is dropped after a couple of minutes. For example, the last time a run this script the server just stopped and reported: “This lasted 0:02:27.517715”, the time before that the client could receive data for about 7 minutes before it dropped the connection. Now, I haven’t done a lot of network programming in my days, so I don’t know if it is reasonable to to expect that they stay connected a lot longer than that? How long can one expect an active TCP connection to live? How common are disconnections like these?

I have conducted these tests in order to test my own local network, as I have been having problems with MSN logging out once an hour, downloads stopping after a couple of minutes and other strange behavior. My question is not how to fix this, but just if the results of my tests are reasonable, or point to problems with my network?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:46:15+00:00Added an answer on May 18, 2026 at 8:46 pm

    A TCP connection can stay up for years* and pass an unlimited amount of data. What are the errors you are getting from the client and the server when they are disconnected? This would be the first step toward tracking down the problem.

    [*] I’d say indefinitely in theory but I’ve only personally observed “years”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.