Menu

#1138 [mrpeach/tcpserver] send data to wrong client

v0.45
open
nobody
None
5
2014-02-27
2014-02-25
No

Discussion

  • Antoine Villeret

    ok, ticket was created without any description... nice

    So here is a pd-patch that demonstrates the issue.
    It seems to appear only after the client get connected.

    The patch is similar to the one reported in issue #1135, so it crashes on 64bit Ubuntu.

    Here the client1 connect to server and then send float 1, the server should send it back to the client thanks to the [send <socket> <list>( message. But sometimes, client1 receive float 2, targeted to client2. Then the client disconnect after receiving data and connect again.

    Tested on Ubuntu 12.04 32bit.

     
  • Cyrille Henry

    Cyrille Henry - 2014-02-25

    confirmed on ubuntu 13.10 / 64 bit

     
  • Martin Peach

    Martin Peach - 2014-02-26

    It may be that when closing/opening the sockets, client 1 on socket 11 becomes client 1 on socket 12, since the threads and Pd can be a bit out of sync. The problem goes away if you add a small delay to one of the client sends.

     
  • Antoine Villeret

    There is something that I don't understand.

    Here is the behavior I'am expecting :
    1- [tcpserver] listen for connection on port 48000
    2- [client1] connect to the server, so a socket is opened and [tcpserver] seems to report it right
    3- after 2 seconds, [client1] sends some data to the server.
    4- the server reports the socket on which data comes and then reports the data on the right outlet
    5- the server send those data back to the client's socket
    6- the client gets the data and disconnect

    Am I right or am I expecting surrealistic behavior ?

    According to some [print] I've put in my patch, it appears that [tcpserver] reports the right socket number, but send the wrong data to that socket.
    Or maybe the client's socket changed between client send and receive routine.
    How this is possible ?

    Putting a big delay between connection and sending data doesn't help. Or at least, 2 seconds is not enough.
    I also tried with a random delay between 2 and 2.1 sec on each client, I still got wrong data.

    So I do think there is still an issue with this but I don't know if it is on server or client side.

     

Anonymous
Anonymous

Add attachments
Cancel