Пример #1
0
        private void ReceivedCallback(IAsyncResult asyncResult)
        {
            try
            {
                ReceivedDataLen = Sock.EndReceiveFrom(asyncResult, ref SocketSettings.ServerEndPoint);
            }
            catch (SocketException) { return; }
            catch (ObjectDisposedException) { return; }

            if (ReceivedDataLen > 0)
            {
                EventProvider.ExecuteReceivedDataHandler(Pack.Clone(), this);
                Array.Clear(Pack, 0, Pack.Size);
            }

            Sock.BeginReceiveFrom(Pack, 0, Pack.Size, SocketFlags.None, ref SocketSettings.ServerEndPoint, ReceivedCallback, obj);
        }