losing messages

Options
lumius
edited July 2012 in DotNet
thanks for Tobias. now i can chat & whisper each other.

but i have another problem.

i receive request and send events to all peers with sendto method.

i tested with two client with same code

and in server log there is all received messages from both clients,

but in client(unity) log, some of them is missing irregularly to both clients not the same time.

for example,

if i send from A 'aaaa' then server receive 'aaaa' and send it to all user include A

in A's log event received with 'aaaa' but B aren't, opposite too.

some time both client can't receive event.

how could it be?

p.s. i have no idea why it is happen, and if it is server-side problem then sorry for wrong category.

Comments

  • Tobias
    Options
    This can happen easily, if you send something unreliably.
    It also happens if one client is disconnected or not yet in the room, while trying to send something.

    I don't know enough, so I can only guess.
    How does your send code look?
  • lumius
    Options
    SentEvent: ConnID=92, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=95, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=96, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=97, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=99, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=100, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=102, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=104, evCode=11, ChannelId=1, result=Disconnected size=37 bytes
    SentEvent: ConnID=105, evCode=11, ChannelId=1, result=Ok size=37 bytes

    this is log when that happens.


    PList = new PeerList(initRequest.Protocol, initRequest.PhotonPeer);
    peers.Add(PList);

    this is adding peer to list.

    sendParameters.Encrypted = false;
    sendParameters.Unreliable = true;
    eventData.SendTo(peers, sendParameters);

    this is sending part.

    peers.RemoveAt(idx);

    this calls onDisconnect function.


    if i log peers then it prints list of connected peers well. but like top log sendevent to disconnected peer.
  • lumius
    Options
    i'm sorry, my unreliable is set to true.

    i change this to false, and it work fine.
  • Tobias
    Options
    Ah. That explains it :)
    UDP packages get dropped when the traffic is too high or for other reasons. If you use our reliable UDP, it will repeat sending when a command wasn't acknowledged. If this happens too often, a "timeout disconnect" might happen.
    So in any case, it makes sense to reduce the number of commands used and the length of them to get the best connection.