Quote:
Originally Posted by EmmeTheCoder
Again, I'm logging all packets and there's no wierd ones. Ping packet is being sent every 10 second I believe, and that's normal, and sometimes the Time packet, but no packet is incorrect I believe.
|
something to try ,
as long as you are getting a random disconnection you can check if the socket is still connected or not. after the disconnection im not sure if you are checking on the sending/receiving if possible send if not disconnect
but.... if you are not doing that than you can try this,
Remove The Client.Disconnect voids out of the Send Void (if you are checking on the connections)
PHP Code:
public static void CMD(Character Client )
{
bool blockingState = client._Sock.Blocking;
try
{
byte [] tmp = new byte[1];
client._Sock.Blocking = false;
client._Sock.Send(tmp, 0, 0);
Console.WriteLine("Connected!");
}
catch (SocketException e)
{
if (e.NativeErrorCode.Equals(10035))
Console.WriteLine("Still Connected, but the Send would block");
else
{
Console.WriteLine("Disconnected: error code {0}!", e.NativeErrorCode);
}
}
finally
{
client._Sock.Blocking = blockingState;
}
Console.WriteLine("Connected: {0}", client.Connected);
}
sending a wrong value to the client well result a disconnection sometimes so
if you sent that void as a cmd through the console screen + name/uid of the client to check on,
if the socket is still connected than its a random value being sent to the client Else its it has something to do with the socket system/Data Sending
i dont know what im thinking lol but i have had the same thing before and i had it done by removing the (Client.Disconnect()) void out of the socket system+ the send void
and than i sent the same peace of code that i provided up there and yep it works lol
hope its useful else ignore it :P