EINPROGRESS

yp66@h... yp66@h...
Thu, 20 Jul 2000 14:18:40 -0000


I am making a client/server application on Linux Redhat 6.1 Python 
5.2 (default redhat distro).
Both the client and server are using asynchat.py
When I use the (default setting) non-blocking client socket, a 
EINPROGRESS exception occurs in the connect method, self.connected 
will not be set to 1 and therefore the flush() method will not do 
anything
(if I set self.connected=1 by hand afterwards, my application works 
like a charm)

(on NT it will give a EWOULDBLOCK)

Is there a simple example for a client/server implemented with 
asynchat at both sides (simpler than the proxy-example) or an 
explanation for my little problem.

With regards,

Jaap

CLIENT (partial)
class PClientSocket (asynchat.async_chat):

def __init__ (self, address=(SERVERIP,SERVERSOCKET)):
asynchat.async_chat.__init__ (self)
self.set_terminator (None)
self.create_socket (socket.AF_INET, socket.SOCK_STREAM)
self.buffer = ''
#self.simpleterminator()
#self.setblocking(1)
self.connect (address)
print address
print self.connected
self.connected=1

...................
SERVER (partial)
class PSocketServer( asyncore.dispatcher ):
def __init__( self, pServer ):
self.pServer = pizzaServer # Registator of all connections
asyncore.dispatcher.__init__( self )
self.create_socket( socket.AF_INET, socket.SOCK_STREAM )
self.set_reuse_addr()
here = ( LISTENIP, LISTENSOCKET )
self.bind( here )
self.listen( 5 )

def handle_accept( self ):
PSocketReceiver( self, self.accept(), self.pServer)

class PSocketReceiver( asynchat.async_chat ):

def __init__( self, server, (conn, addr), pServer):
asynchat.async_chat.__init__( self, conn )
self.simpleterminator()
self.buffer=[]
self.data=[]
self.pConnAddress = addr
log("connection attempt at ip %s port %d" % 
self.pConnAddress )
self.pClient = pServer.connect( self )