[Opentnl-general] Cant get a client / server connection
Brought to you by:
mark_frohnmayer,
s_alanet
From: Jeff N. <jni...@az...> - 2005-03-18 17:43:42
|
I'm just starting with TNL. I'm really excited to be working with it - it seems to be very powerful. I'm trying to get a basic client/server working. I'm working in Visual Studio .NET 2003, using C++, using the Win32 application template, (as opposed to the console app template). I started a project yesterday morning - and I had problems making the client and server connect. After comparing the project settings between my project and the sample TestGame project, I found a setting in the C++ compiler, namely "Enable Run-Time Type Info" that was NO on my project and YES on the sample project. I set it to YES, and my applications connected. YAY! Well, today, I re-wrote the applications from scratch, to familiarize myself with the API. Again, it didn't connect. I tried the same solution (Run Type setting). This time it didn't work, and I can't get the server and client apps to connect. In my solution I have two projects, "server" and "client" - both based on win32 app (not console). I I have my own CMyTNLNetInterface, based on NetInterface, and CMyTNLGhostConnection, based on GhostConnection. For both projects: I link in tnld.lib (Im in debug phase, of course) and ws2_32.lib I define TNL_ENABLE_LOGGING and TNL_DEBUG in the preprocessor In both apps, I set a windows timer to 50ms and in the timer event, I Tick() the NetInterface, calling checkIncommingPackets() and processConnections() Server startup code looks like (port=678) Address addr(IPProtocol,Address::Any,port); m_NetInterface = new CMyTNLNetInterface(addr); m_NetInterface->setAllowsConnections(true); Client connection code looks like: (server="localhost") (port=678) Address addr1 = Address(IPProtocol,Address::Any,0); m_NetInterface = new CMyTNLNetInterface(addr1); Address addr2 = Address(server); addr2.port=port; m_GhostConnection = new CMyTNLGhostConnection; m_GhostConnection->connect(m_NetInterface,addr2); Log shows this when I start the server: 'Server.exe': Loaded (.snip) Winsock initialization succeeded. LogUDP: UDP socket created - bound to address: IP:Any:678 LogUDP: UDP socket receive buffer size set to 32768. LogUDP: UDP socket send buffer size set to 32768. LogUDP: UDP socket non-blocking IO set. Socket initialized. And adds this when I start the client and try to connect (the server and client events are mixed together) 'Client.exe': Loaded (.snip) Winsock initialization succeeded. LogUDP: UDP socket created - bound to address: IP:Any:1732 LogUDP: UDP socket receive buffer size set to 32768. LogUDP: UDP socket send buffer size set to 32768. LogUDP: UDP socket non-blocking IO set. Socket initialized. LogNetInterface: Sending Connect Challenge Request to IP:192.168.0.50:678 LogNetInterface: Received Connect Challenge Request from IP:192.168.0.50:1732 LogNetInterface: Sending Challenge Response: 2c387faf LogNetInterface: Received Challenge Response: 2c387faf Client puzzle solved in 422 ms. LogNetInterface: Sending Connect Request LogNetInterface: Received Connect Request 2c387faf LogNetInterface: Sending Connect Request LogNetInterface: Received Connect Reject - reason Puzzle LogNetInterface: Sending Connect Challenge Request to IP:192.168.0.50:678 LogNetInterface: Received Connect Challenge Request from IP:192.168.0.50:1732 LogNetInterface: Sending Challenge Response: 502963e8 LogNetInterface: Received Challenge Response: 502963e8 Client puzzle solved in 953 ms. LogNetInterface: Sending Connect Request LogNetInterface: Received Connect Request 502963e8 The program '[512] Client.exe: Native' has exited with code 0 (0x0). In the log I see that the connection attempt is being rejected. It seems that the connection puzzle challenge is not being responded to correctly. I *DO* have the onConnectTerminated function overridden on the GhostConnection, but it never gets called. Shouldn't it get called when the connection is rejected? Any ideas? Anyone? Thanks in advance! |