<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hey there,</div>

<div> </div>

<div>Setup:</div>

<div>-i got a Server which is running a Delphi application on Windows7 using WinSocketComponents</div>

<div>-i got a Client (Raspberry Pi) which is running my python client application with twisted</div>

<div>-the server collects data which the client is sending, sometimes the server sends back</div>

<div> </div>

<div>Problem:</div>

<div>-the client connects and starts sending, the communication works fine at first</div>

<div>-after some time (rigth now i see no correlation or principle) the server won't get any messages anymore, although the client keeps sending (or at least the client keeps calling the sendMessage() function</div>

<div>->the client is still able to receive messages!</div>

<div> </div>

<div>I have no clue whats happening. There is no suspicious behavior nor a exception call.</div>

<div>When i stop the client, the server recognizes a disconnect, but before, no disconnect is recognized.</div>

<div>Has anyone of you an idea or does anyone see a mistake in the design of my Factory or Protocol?</div>

<div>Are there known problems with the combination of python twisted and WinSocket of Windows?</div>

<div> </div>

<div>Here are both:</div>

<div> </div>

<div>
<div>class ControllerProtocol(Protocol):</div>

<div>    def connectionMade(self):<br/>
        # send Greeting<br/>
        self.factory.isConnected = True<br/>
        self.transport.write("Hi there Mother.")<br/>
        self.factory.resetDelay()<br/>
        #self.RefToOperator.debug('0 |-> ConnectionMade.')<br/>
            <br/>
    def dataReceived(self, data):<br/>
        "Parse received data and send corresponding Message."<br/>
        self.transport.write(self.factory.reactOnReceive(data))<br/>
                <br/>
    def connectionLost(self, reason):<br/>
        #try to reconnect    <br/>
        self.factory.isConnected = False      <br/>
        #self.RefToOperator.debug( "0 Connection lost")<br/>
        <br/>
    def sendMessage(self, data):<br/>
        self.factory.RefToOperator.debug('2 Sending Message.')<br/>
        self.transport.write(data)</div>

<div><br/>
class Communicator(ReconnectingClientFactory):<br/>
    protocol = ControllerProtocol</div>

<div><br/>
    def __init__(self, operator):<br/>
        """<br/>
        :param operator: Operator<br/>
        :type self.RefToOperator: Operator<br/>
        """<br/>
        self.isConnected       = False  <br/>
        self.connectedProtocol = None<br/>
        self.RefToOperator     = operator   <br/>
        self.maxDelay          = 60                  # maximum number of seconds between connection attempts</div>

<div>    def __del__(self):<br/>
        self.RefToOperator.debug( '0 Stopping SocketClient.')<br/>
        <br/>
    def buildProtocol(self, addr):<br/>
        p = ReconnectingClientFactory.buildProtocol(self, addr)<br/>
        self.connectedProtocol = p<br/>
        return p                                  </div>

<div>    def clientConnectionFailed(self, connector, reason):<br/>
        self.RefToOperator.debug('0 Connection failed. Reason:' + str(reason))<br/>
        logging.warning('Connection failed. Reason: %s', reason)<br/>
        ReconnectingClientFactory.clientConnectionFailed(self, connector, reason)       </div>

<div>    def clientConnectionLost(self, connector, reason):<br/>
        self.RefToOperator.debug('0 Lost connection.  Reason:' + str(reason))<br/>
        self.connectedProtocol = None<br/>
        logging.debug('Connection lost. Reason: %s', reason)<br/>
        ReconnectingClientFactory.clientConnectionLost(self, connector, reason)       <br/>
        <br/>
    def reactOnReceive(self, String):<br/>
        self.RefToOperator.debug('2 Received Data from Mothership:' + str(String))<br/>
        self.RefToOperator.reactOnReceivedData(String)<br/>
       <br/>
    def sendMessage(self, Message):<br/>
        self.connectedProtocol.SendMessage(Message)</div>

<div> </div>

<div>I woul'd be glad about any help or clue.</div>

<div>Greets,</div>

<div>Toni</div>
</div></div></body></html>