<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>&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma">I'm&nbsp;trying&nbsp;to write a typical chat server application with twisted.&nbsp;At this moment, all is working fine except for some strange behaviour with&nbsp;sendLine and&nbsp;connectionLost funcs. Let me explain the problem:</font></div>
<div dir="ltr">&nbsp;</div>
<div dir="ltr"><font size="2" face="tahoma">- I have&nbsp;a server&nbsp;on the internet.</font></div>
<div dir="ltr"><font size="2" face="tahoma">-&nbsp;I&nbsp;connect two PCs (2 clients)&nbsp;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&nbsp;(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&nbsp;all clients through this function:</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font>&nbsp;</div>
<div dir="ltr">&nbsp;&nbsp;&nbsp; def sendMessageToAllClients(self, mesg,reqClient):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for client in self.clientProtocols:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dataLength = str(len(mesg))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (len(dataLength) &lt; 8):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dif = 8 - len(dataLength)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dataLength = &quot;0&quot;*dif &#43; dataLength<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;Enviando a:&quot;,str(client)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.sendLine(dataLength&#43;mesg)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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 &quot;out&quot;. 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 &quot;non clean fashion&quot;.</font></div><div style="FONT: bold 13px 'Trebuchet MS'; COLOR: black"><font size="2" face="trebuchet ms"></font>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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&nbsp; 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 &lt;<A href="mailto:support@unipost.es">support@unipost.es</A>&gt;.</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 &lt;<A 
href="mailto:support@unipost.es">support@unipost.es</A>&gt;.<BR>-----------------------------------------------------------------------<BR></P>
</body>
</html>