void HandleSendResult(int written, bool sync) { buffer.Remove(written); Debug.WriteLine("KayakSocket: Wrote " + written + " " + (sync ? "" : "a") + "sync, buffer size is " + buffer.Size); bool shutdownSocket = false; bool raiseClosed = false; state.EndWrite(BufferIsEmpty(), out shutdownSocket, out raiseClosed); if (shutdownSocket) { Debug.WriteLine("KayakSocket: shutting down socket after send."); socket.Shutdown(); } if (raiseClosed) { RaiseClosed(); } }
public void LocalShutdownBothOnSocket() { // Local shutdown_Both (Socket). if (m_spFactory.SocketSupportsShutdown) { using (ITestSocketPair pair = m_spFactory.CreateSocketPair()) { ISocketWrapper sock = pair.SocketA; NetworkStream strm = sock.GetStream(); Assert.IsTrue(sock.Connected, "6a"); sock.Shutdown(SocketShutdown.Both); Assert.IsFalse(sock.Connected, "6b"); } } }