[Twisted-Python] PB and unstable network

Yaroslav Fedevych jaroslaw.fedewicz at gmail.com
Tue May 25 08:41:13 MDT 2010


In your case, I would suggest that the server sends some sort of ACK
after it has received the payload from client, and the client must
send the same kind of ACK in response. Only after that would the
server consider operation complete, otherwise it would either inform
the client that the previous operation was interrupted midway, or
discard the incomplete message completely, thus forcing client to
re-send it.

Sounds complicated, but I think that's the only reliable way to make
sure things don't get duplicated on either server or client.

On Tue, May 25, 2010 at 11:34 AM, Viktor Klimov <ploutosss at gmail.com> wrote:
> Hi Glyph, sorry for my english.
>
> My server.py save last answer(see User.perspectiveMessageReceived).
>
> Client when an error occurs(in callRemote) schedule reconnect. After
> reconnect client call remote method which return last answer.
>
> It works if disconnect happened when server send data to
> client(_server->client_). (try set MyServer.crash_server_to_client to
> True)
>
> But it doesn't work if disconnect happened when client send data to
> server(_client->server_). Becouse server after reconnect send previous
> data. It can fix if client be known when error occurs(server->client
> or client->server). (see comment in Client.net_error).
>
> PS for emulate error client->server set Client.crash_client_to_server
> to True, don't forget set MyServer.crash_server_to_client to False)
>
> On Mon, May 24, 2010 at 5:19 AM, Glyph Lefkowitz
> <glyph at twistedmatrix.com> wrote:
>> On May 23, 2010, at 11:54 AM, Viktor Klimov wrote:
>>
>>> I use PB in unstable network. The server remembers the last answer.
>>> Client detection disconnected, connected again, makes entry into the
>>> system and calls the function returns the last response
>>> (get_last_response). The answer, it returns a deferred saved earlier.
>>> If somewhere an error cycle repeats.
>>>
>>> All of this works until the lost communication does not happen at a
>>> time when Twisted sends data to a server. As the server in this
>>> situation does not receive a first request, and when you call
>>> get_last_response client receives the data that has already received.
>>>
>>> How can I check if an error in the client arrived data to the server or not?
>>
>> Hi Viktor,
>>
>> I try not to give people a hard time about bad English, but I am having a hard time reading your message.  There are a couple of different things I think you might mean and it would be confusing if I tried to explain them all.
>>
>> Perhaps you could attach some Python code that explains exactly what you mean?
>>
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>




More information about the Twisted-Python mailing list