protected void ReadNetwork() { EndPoint readEp = new IPEndPoint(IPAddress.Parse(CommonSocketBase.LOCAL_IPV4), 0); var buffer = new BMSByte(); buffer.SetArraySize(2048); try { while (true) { CancellationSource.Token.ThrowIfCancellationRequested(); buffer.Clear(); ManagedSocket.Receive(buffer, ref readEp); ProcessMessageRead(buffer, readEp); } } catch (OperationCanceledException) { } }
public virtual void ShutDown() { CancellationSource.Cancel(); ManagedSocket.Close(); }