protected override void Dispose(bool disposing) { Debug.WriteLine("NS Dispose (" + disposing + ")"); if (disposed) { return; } disposed = true; readable = false; writeable = false; if (disposing) { if (owns_socket || socket is CrestronClientSocket) { var s = socket; if (s != null) { s.Close(); } } socket = null; access = 0; } base.Dispose(disposing); }
public NetworkStream(Socket socket, FileAccess access, bool ownsSocket) { if (socket == null) { throw new ArgumentNullException("socket is null"); } if (socket.SocketType != SocketType.Stream) { throw new ArgumentException("Socket is not of type Stream", "socket"); } if (!socket.Connected) { throw new IOException("Not connected"); } if (!socket.Blocking) { throw new IOException("Operation not allowed on a non-blocking socket."); } this.socket = socket; this.owns_socket = ownsSocket; this.access = access; readable = CanRead; writeable = CanWrite; }
public NetworkStream(CrestronSocket socket, FileAccess access, bool ownsSocket) { if (socket == null) { throw new ArgumentNullException("socket is null"); } if (!socket.Connected) { throw new IOException("Not connected"); } this.socket = socket; owns_socket = ownsSocket; this.access = access; readable = access == FileAccess.ReadWrite || access == FileAccess.Read; writeable = access == FileAccess.ReadWrite || access == FileAccess.Write; }
public NetworkStream(CrestronSocket socket, FileAccess access) : this(socket, access, false) { }
public NetworkStream(CrestronSocket socket, bool ownsSocket) : this(socket, FileAccess.ReadWrite, ownsSocket) { }
public NetworkStream(CrestronSocket socket) : this(socket, FileAccess.ReadWrite, false) { }