L
Luis P. Mendes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I've developed a program that uses a socket to receive information 24h a
~ day.
The problem is that the socket seems to freeze. By that I mean the
program stops getting information but doesn't raise any error.
I tried to solve this by writing the following functions, in order to
try to start the socket connection again:
def keepAlive(self):
~ self.alive = 0
~ tnow = time.time()
~ if tnow - self.lastTime > 90: # last time got from last string
received from the socket
~ self.alive = 1
def reSocket():
~ print "socket has failed", time.strftime('%X', time.localtime())
~ time.sleep(60)
~ l=GServer() # new instance that contains the socket
reSocket is triggered when self.alive is 1.
But it hasn't solved my problem. These functions have effect only after
I do a ^C, and even then, the socket doesn't start to acquire new input.
Any clues you can give me about this?
Luis P. Mendes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFECEF8Hn4UHCY8rB8RAtaaAKCnFb2O28AE4uRTK0sPSpnOifaDzACdG2EA
imVqvzcRX4qGWqMzLRUcyao=
=Cqkb
-----END PGP SIGNATURE-----
Hash: SHA1
Hi,
I've developed a program that uses a socket to receive information 24h a
~ day.
The problem is that the socket seems to freeze. By that I mean the
program stops getting information but doesn't raise any error.
I tried to solve this by writing the following functions, in order to
try to start the socket connection again:
def keepAlive(self):
~ self.alive = 0
~ tnow = time.time()
~ if tnow - self.lastTime > 90: # last time got from last string
received from the socket
~ self.alive = 1
def reSocket():
~ print "socket has failed", time.strftime('%X', time.localtime())
~ time.sleep(60)
~ l=GServer() # new instance that contains the socket
reSocket is triggered when self.alive is 1.
But it hasn't solved my problem. These functions have effect only after
I do a ^C, and even then, the socket doesn't start to acquire new input.
Any clues you can give me about this?
Luis P. Mendes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFECEF8Hn4UHCY8rB8RAtaaAKCnFb2O28AE4uRTK0sPSpnOifaDzACdG2EA
imVqvzcRX4qGWqMzLRUcyao=
=Cqkb
-----END PGP SIGNATURE-----