Example #1
0
        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) { }
        }
Example #2
0
 public virtual void ShutDown()
 {
     CancellationSource.Cancel();
     ManagedSocket.Close();
 }