santosh.a Posted December 24, 2014 Share Posted December 24, 2014 Hi, I just began writing network code for our project and got stuck with a few issues. I can run two servers : Server 1: port 50000 Server 2: port 50001 Now the client application has to search for the first available server from these two and connect to it. So first I need to find an available server. For this, inside Client init() I'm doing : network.pingAvailableLANServers( 49999, 50000 ); network.pingAvailableLANServers( 49999, 50001 ); The NETWORK_ON_PONG_RECEIVED call is registered to be handled by onPongReceived(). So assuming both servers are running, I can expect onPongReceived() to be triggered twice, once from each server. But that's not happening. 1. onPongReceived() is triggered only from the last server (port 50001). If 3 servers are running, callback is still triggered only from the last server. 2. A single ping is causing 2 onPongReceived() callbacks instead of 1, everytime. Note: For ease of coding, I'm running all server and client instances from a single PC. Kindly let me know any mistake in my logic. Thanks. Link to comment
unclebob Posted December 25, 2014 Share Posted December 25, 2014 Hi there, Santosh! Network plugin may skip packets only if you set different game info both on server and client, otherwise it should receive all the packets. I recommend you to install network sniffer in order to understand where the root of the problem is. It may be either hardware (network interface) or software (Raknet, OS or Unigine) issue and you need to make sure your servers receive ping packets and send pong packets back. The same rule goes for clients. Another nice thing you can do is to run your application with the debugger attached. You can set breakpoint to NetworkNode::handle_pong method and see what's happening inside. If everything is fine with the packets and network transport but you still have troubles with callbacks then please attach your code sample here and I'll dig into it and give you more details. Thank you! Link to comment
santosh.a Posted December 26, 2014 Author Share Posted December 26, 2014 Thanks Unclebob, let me check the things you said and get back to you. Link to comment
Recommended Posts