<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style title="owaParaStyle"><!--P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
</head>
<body ocsi="x">
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">Hi all,</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">I'm trying to write a typical chat server application with twisted. At this moment, all is working fine except for some strange behaviour with sendLine and connectionLost funcs. Let me explain the problem:</font></div>
<div dir="ltr"> </div>
<div dir="ltr"><font size="2" face="tahoma">- I have a server on the internet.</font></div>
<div dir="ltr"><font size="2" face="tahoma">- I connect two PCs (2 clients) from the same LAN through a router to that server</font></div>
<div dir="ltr"><font size="2" face="tahoma">- All is working fine until I disconnect the LAN of one of those PC (The client is disconnected but the server doesn't know about it). Just to test a typical wireless disconnection without closing sockets, etc...</font></div>
<div dir="ltr"><font size="2" face="tahoma">- After disconnecting I try to send some messages through the remaining clients to all clients through this function:</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"> def sendMessageToAllClients(self, mesg,reqClient):<br>
for client in self.clientProtocols:<br>
dataLength = str(len(mesg))<br>
if (len(dataLength) < 8):<br>
dif = 8 - len(dataLength)<br>
dataLength = "0"*dif + dataLength<br>
print "Enviando a:",str(client)<br>
client.sendLine(dataLength+mesg)<br>
client.clearLineBuffer()</div>
<div><font size="2" face="Tahoma">
<pre style="FONT-FAMILY: verdana,arial; FONT-SIZE: 8pt"><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black">As you can see, I send a message to all clients, including the one disconnected because the server doesn't</div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"> know at this moment that the client is "out". I'm able to send 6 or 7 messages to the remaining client but</div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"> after that, the connection get lost. I would expect to have a connectionLost with the client offline but actually</div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms">I got a connectionLost in both clients and I don't know why.</font> <font size="2" face="trebuchet ms">The server disconnect both clients with "non clean fashion".</font></div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms"></font> </div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms">Any help or advice would be highly appreciated.</font></div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms"></font> </div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms">Regards,</font></div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms"></font> </div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms">David</font></div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms"></font> </div></pre>
</font></div>
<P
align=left>-----------------------------------------------------------------------</P>
<P>Este mensaje es confidencial y atañe exclusivamente a las personas a las que
va dirigido.<BR>Cualquier opinión en el contenida, es exclusivo de su autor y no
representa necesariamente<BR>la opinion de <STRONG>UNIPOST, S.A.</STRONG><BR>Si
Ud. no es el destinatario del mensaje, considerese advertido que lo ha
recibido por error<BR>y que cualquier difusión o copia estan terminantemente
prohibidos. Si ha recibido por error, <BR>por favor comuniquelo a
<STRONG>UNIPOST, S.A</STRONG>. al número +34 93 223 25 52 o correo electrónico
<BR>a <<A href="mailto:support@unipost.es">support@unipost.es</A>>.</P>
<P align=left>This e-mail is confidential and intended solely for the use of the
individual to whom it is addressed.<BR>Any opinions presented are solely those
of the author and do not necessarily represent those of <BR><STRONG>UNIPOST,
S.A.<BR></STRONG>If you are not the intended recipient, be advised that you have
received this e-mail in error and that <BR>dissemination, forwarding or copying
of this e-mail is strictly prohibited. If you have received this <BR>e-mail in
error please notify it to <STRONG>UNIPOST, S.A</STRONG>. by telephone on number
+34 93 223 25 52 or by<BR>e-mail to <<A
href="mailto:support@unipost.es">support@unipost.es</A>>.<BR>-----------------------------------------------------------------------<BR></P>
</body>
</html>