/// <summary> /// Reads COTP TPDU (Transport protocol data unit) from the network stream /// See: https://tools.ietf.org/html/rfc905 /// </summary> /// <param name="stream">The socket to read from</param> /// <returns>COTP DPDU instance</returns> public static TPDU Read(Stream stream) { var tpkt = TPKT.Read(stream); if (tpkt.Length > 0) { return(new TPDU(tpkt)); } return(null); }
/// <summary> /// Reads COTP TPDU (Transport protocol data unit) from the network stream /// See: https://tools.ietf.org/html/rfc905 /// </summary> /// <param name="socket">The socket to read from</param> /// <returns>COTP DPDU instance</returns> public static TPDU Read(Socket socket) { var tpkt = TPKT.Read(socket); if (tpkt.Length > 0) { return(new TPDU(tpkt)); } return(null); }
/// <summary> /// Reads COTP TPDU (Transport protocol data unit) from the network stream /// See: https://tools.ietf.org/html/rfc905 /// </summary> /// <param name="stream">The socket to read from</param> /// <returns>COTP DPDU instance</returns> public static TPDU Read(Stream stream) { var tpkt = TPKT.Read(stream); if (tpkt.Length == 0) { throw new TPDUInvalidException("No protocol data received"); } return(new TPDU(tpkt)); }