This may be a little long of a post
I have a server and a client, and i have the ability to see the sent/rec messages and count them on both machines live, so that i dont have to go into debug in VS2012,
i am running my server on an alternate machine in California so that the server and the client are on completely different IP's and running through the internet for live tests, they are using DNS names and resolving them fine.
Both Physical PC's have no antivirus and no firewall and windows firewall is off on both.
Both machines have wireshark installed for tracking my packets on UDP port 29999
How the sequence works is the client sends a logon, the server verifies the client by some credentials and the server sends player information (stats)
When starting the server executable the first time, the messages come through to the client without failing. every time
if you restart the client and try again the client does not receive the messages.
1) The counter on the server.exe increments properly, 2) Server's Wireshark on the server shows the messages sent 3) Client's Wireshark sees the UDP packets come in on the proper port from the proper IP address
but the client.exe message counter does not increment.
If i run the client in DEBUG mode in VS2012 and set a breakpoint as shown here :
while ((_NetworkIncomingMsg = _NetworkClient.ReadMessage()) != null)
{
ReadInTime = DateTime.Now; // <<-- break point here
// blah blah more code
}
It never hits, no message is ever received.
Its important to note that if i but a break point on the while statement, yes it is firing, but no message is read, and thus its null, and thus skips the code
I believe it has something to do with either the timing or the placement of the ReadServerMessages() method.
i have the ReadServerMessages() method being firing on a Timer as an event under its elapsed as shown here. The timer is constructed to fire ever 1.0 milliseconds. As this works pretty much flawlessly in every other portion of the software including when actully connected to a dedicated server and constantly sending packets.
public System.Timers.Timer ClientNetworkTick = new System.Timers.Timer(1.0);
void update_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
// Check if server sent new messages
try
{
ReadServerMessages();
}
catch (Exception ex)
{
}
}
Any thoughts? any thing i left out let me know thanks!