}
catch (SocketException e)
{
- HandleDisconnect(new HazelException("A Socket exception occured while initiating a body receive operation.", e));
+ HandleDisconnect(new HazelException("A Socket exception occured while initiating a header receive operation.", e));
}
Statistics.LogReceive(bytes.Length, bytes.Length + 4);
InvokeDataReceived(bytes, SendOption.FragmentedReliable);
}
+ /// <summary>
+ /// Starts this connection receiving data.
+ /// </summary>
+ internal void StartReceiving()
+ {
+ try
+ {
+ StartWaitingForHeader();
+ }
+ catch (SocketException e)
+ {
+ HandleDisconnect(new HazelException("A Socket exception occured while initiating the first receive operation.", e));
+ }
+ }
+
/// <summary>
/// Starts this connections waiting for the header.
/// </summary>
- internal void StartWaitingForHeader()
+ void StartWaitingForHeader()
{
StartWaitingForBytes(4, HeaderReadCallback);
}
//Invoke
InvokeNewConnection(tcpConnection);
- try
- {
- tcpConnection.StartWaitingForHeader();
- }
- catch (SocketException)
- {
- //Receive operation couldn't be started, there's nothing we can do to save it
- return;
- }
+ tcpConnection.StartReceiving();
}
}