Esempio n. 1
0
 /// <summary>
 ///		Performs protocol specific asynchronous 'Receive' operation.
 /// </summary>
 /// <param name="context">Context information.</param>
 protected sealed override void ReceiveCore(ClientResponseContext context)
 {
     if (!BoundSocket.ReceiveFromAsync(context.SocketContext))
     {
         context.SetCompletedSynchronously();
         OnReceived(context);
     }
 }
Esempio n. 2
0
 /// <summary>
 ///		Performs protocol specific asynchronous 'Send' operation.
 /// </summary>
 /// <param name="context">Context information.</param>
 protected sealed override void SendCore(ClientRequestContext context)
 {
     if (!BoundSocket.SendToAsync(context.SocketContext))
     {
         context.SetCompletedSynchronously();
         OnSent(context);
     }
 }
 public void StopListening()
 {
     if (!KeepGoing)
     {
         return;
     }
     KeepGoing = false;
     BoundSocket.Dispose();
 }
Esempio n. 4
0
        protected override void Receive()
        {
            if (!KeepGoing)
            {
                return;
            }

            signal.Reset();
            BoundSocket.BeginAccept(AcceptCallback, BoundSocket);
            signal.WaitOne();
        }
Esempio n. 5
0
        /// <summary>
        ///		Shutdowns the receiving.
        /// </summary>
        protected sealed override void ShutdownReceiving()
        {
            try {
                BoundSocket.Shutdown(SocketShutdown.Receive);
            }
            catch (SocketException ex) {
                if (ex.SocketErrorCode != SocketError.NotConnected)
                {
                    throw;
                }
            }

            base.ShutdownReceiving();
        }
Esempio n. 6
0
 protected override void SetupSocket(IPEndPoint ipEndPoint)
 {
     base.SetupSocket(ipEndPoint);
     BoundSocket.Listen(listeningSocketBacklog);
 }
 protected virtual void SetupSocket(IPEndPoint ipEndPoint)
 {
     BoundSocket.Bind(ipEndPoint);
 }