asyncore.py, Windows and Connection refused

Jesus Cea Avion jcea at argo.es
Mon Aug 7 14:14:09 EDT 2000


Asyncore module in windows seems not to report "RST" responses to TCP
"SYN" packets.

Take the following code:

>>>>>

import asyncore

class a(asyncore.dispatcher):
  def __init__(self):
    import socket
    asyncore.dispatcher.__init__(self)
    self.create_socket(socket.AF_INET,socket.SOCK_STREAM)

try :
  b=a()
  b.connect(("195.53.30.2",11011))
except :
  import sys
  print "fallo ",sys.exc_info()[0],sys.exc_info()[1]

print "*** Before"
asyncore.poll(5)
print "*** After"

import time

time.sleep(2)

<<<<<

Now adapt the IP and the port to your own network and execute the
previos code IN A WINDOWS MACHINE (Solaris runs OK). So, you have to
posibilities:

* The Port is open: You connect to the server and two unhandled events
  arrives: connect and write.

* The port is closed: The server refuses connection. In the code runs
  in a windows OS, it keeps trying (four times) until the timeout
  expires. In a Solaris environment, the "poll" end inmediatelly with
  a connect, a read and a write event.

A bug?.

I need to detect the closed port in windows. Can anybody help me?

-- 
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea at argo.es http://www.argo.es/~jcea/ _/_/    _/_/  _/_/    _/_/  _/_/
                                      _/_/    _/_/          _/_/_/_/_/
PGP Key Available at KeyServ   _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz



More information about the Python-list mailing list