/// <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); } }
/// <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(); }
protected override void Receive() { if (!KeepGoing) { return; } signal.Reset(); BoundSocket.BeginAccept(AcceptCallback, BoundSocket); signal.WaitOne(); }
/// <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(); }
protected override void SetupSocket(IPEndPoint ipEndPoint) { base.SetupSocket(ipEndPoint); BoundSocket.Listen(listeningSocketBacklog); }
protected virtual void SetupSocket(IPEndPoint ipEndPoint) { BoundSocket.Bind(ipEndPoint); }