GithubHelp home page GithubHelp logo

Comments (5)

dakikifr avatar dakikifr commented on June 16, 2024

I tried using my android device (receiver), along with an iphone as sender. I have the same issue (not on the first message that I'm sending, but on another one right after).

I managed to capture the traffic from my iPhone, but I couldn't identify the TCP traffic from my application. Is gpg using SSL or something for p2p communication?
How can I help debugging this very important issue?
Thanks

from cpp-ios-basic-samples.

dakikifr avatar dakikifr commented on June 16, 2024

I managed to produce this critical issue using the ButtonClicker source code.
Here is what I've done:

Add this method to ButtonClickerEngine.mm:

void ButtonClickerEngine::SendPacket(int val) {
    std::vector<uint8_t> v;
    v.resize(1400);
    v[0] = static_cast<uint8_t>(val);
        const std::vector<gpg::MultiplayerParticipant> participants =
        room_.Participants();
        for (gpg::MultiplayerParticipant participant : participants) {
            service_->RealTimeMultiplayer().SendReliableMessage(
                                                                room_, participant, v, [val](gpg::MultiplayerStatus const & status) {
                                                                    if(gpg::IsSuccess(status) == false)
                                                                        LOGI("Failed to send message idx %d (%d)", val, status);
                                                                });
        }
}

Then edit GameModel.mm and change the startGame method so it looks like that

- (void)startGame {
  if (_gameState == BCGameStateWaitingToStart) {
    _gameState = BCGameStatePlaying;
    _startTime = CACurrentMediaTime();
      for(int i=0;i<10;i++)
          ButtonClickerEngine::GetInstance().SendPacket(i);
  }
}

Then run the game on 2 devices (I've used an iPhone and an iPad), and you'll often have out of order packets in the log like this log (as well as Errors during send):

2015-05-15 21:58:00.996 ButtonClicker[3301:1080849] Failed to send message idx 0 (-3)
2015-05-15 21:58:00.997 ButtonClicker[3301:1080849] Failed to send message idx 0 (-2)
2015-05-15 21:58:00.997 ButtonClicker[3301:1080849] Failed to send message idx 1 (-2)
2015-05-15 21:58:00.998 ButtonClicker[3301:1080849] Failed to send message idx 2 (-2)
2015-05-15 21:58:00.999 ButtonClicker[3301:1080849] Failed to send message idx 3 (-2)
2015-05-15 21:58:00.999 ButtonClicker[3301:1080849] Failed to send message idx 4 (-2)
2015-05-15 21:58:00.999 ButtonClicker[3301:1080849] Failed to send message idx 5 (-2)
2015-05-15 21:58:01.000 ButtonClicker[3301:1080849] Failed to send message idx 6 (-2)
2015-05-15 21:58:01.003 ButtonClicker[3301:1080849] Failed to send message idx 7 (-2)
2015-05-15 21:58:01.003 ButtonClicker[3301:1080849] Failed to send message idx 8 (-2)
2015-05-15 21:58:01.003 ButtonClicker[3301:1080849] Failed to send message idx 9 (-2)
2015-05-15 21:58:01.170 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.171 ButtonClicker[3301:1080849] Got message of size 1400 (0)
2015-05-15 21:58:01.173 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.174 ButtonClicker[3301:1080849] Got message of size 1400 (1)
2015-05-15 21:58:01.195 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.196 ButtonClicker[3301:1080849] Got message of size 1400 (3)
2015-05-15 21:58:01.198 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.198 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.199 ButtonClicker[3301:1080849] Got message of size 1400 (2)
2015-05-15 21:58:01.199 ButtonClicker[3301:1080849] Got message of size 1400 (4)
2015-05-15 21:58:01.224 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.224 ButtonClicker[3301:1080849] Got message of size 1400 (5)
2015-05-15 21:58:01.232 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.232 ButtonClicker[3301:1080849] Got message of size 1400 (6)
2015-05-15 21:58:01.235 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.236 ButtonClicker[3301:1080849] Got message of size 1400 (7)
2015-05-15 21:58:01.677 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.677 ButtonClicker[3301:1080877] VERBOSE: RoomServiceStateMachine: Reliable message received : [email protected]/games_ios61CD4D53
2015-05-15 21:58:01.678 ButtonClicker[3301:1080849] Got message of size 1400 (8)
2015-05-15 21:58:01.678 ButtonClicker[3301:1080849] Got message of size 1400 (9)
201

Please advice since this is a critical issue preventing any real usage of your Realtime APIs.
Maybe you could expose the sockets for advanced users (both TCP and UDP)?
Thanks!

from cpp-ios-basic-samples.

dakikifr avatar dakikifr commented on June 16, 2024

Hi,

have you managed to reproduce this bug using the modified ButtonClicker sample?
Thanks!

from cpp-ios-basic-samples.

dakikifr avatar dakikifr commented on June 16, 2024

I tried the sendReliableMessageBlocking method of the SDK, using a specific thread to send the data, and sync my main thread with the sending thread (so it continues only when the sendReliableMessageBlocking method returns), and it's working a little better.
Let me explain:
The burst send of 1400 chunks are now almost always arriving in order (and I still sometimes have an error returned by the send method, although the message is arriving fine and in order).
But when the receiver answers by send 2 small messages (the 1st is 4 bytes, the second is 5 bytes), it almost always arrives out-of-order (the same code is used to send the chunks, using sendReliableMessageBlocking and a thread).

Please advice?
Have you tried to reproduce this using the sample?
Did you succeed?
Realtime multiplayer is a core part of my game and I cannot ignore it.
I'll have no choice but to use another Gaming framework if this one is not stable enough.
Thanks for your help

from cpp-ios-basic-samples.

dakikifr avatar dakikifr commented on June 16, 2024

Still no answer (at least an acknowledgment of the issue being reproduced) after more than a month.
Is the c++ gpg framework abandoned?

from cpp-ios-basic-samples.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.