protected void StartReceive(CitpReceiveData receiveState) { try { receiveState.SetLength(receiveState.ReadPosition + receiveState.ReadNibble); client.Client.BeginReceive(receiveState.GetBuffer(), receiveState.ReadPosition, receiveState.ReadNibble, SocketFlags.None, new AsyncCallback(OnReceive), receiveState); } catch (Exception ex) { OnUnhandledException(new ApplicationException("An error ocurred while trying to start recieving CITP.", ex)); } }
public void StartReceive() { try { EndPoint localPort = new IPEndPoint(IPAddress.Any, Port); CitpReceiveData receiveState = new CitpReceiveData(); receiveState.SetLength(receiveState.Capacity); BeginReceiveFrom(receiveState.GetBuffer(), 0, receiveState.ReadNibble, SocketFlags.None, ref localPort, new AsyncCallback(OnReceive), receiveState); } catch (Exception ex) { OnUnhandledException(new ApplicationException("An error ocurred while trying to start recieving CITP.", ex)); } }