- // ==++==
- //
- //
- // Copyright (c) 2002 Microsoft Corporation. All rights reserved.
- //
- // The use and distribution terms for this software are contained in the file
- // named license.txt, which can be found in the root of this distribution.
- // By using this software in any fashion, you are agreeing to be bound by the
- // terms of this license.
- //
- // You must not remove this notice, or any other, from this software.
- //
- //
- // ==--==
- //==========================================================================
- // File: TcpWireProtocol.cs
- //
- // Summary: Class for managing a socket connection.
- //
- //==========================================================================
- using System;
- using System.IO;
- using System.Net.Sockets;
- using System.Text;
- using System.Threading;
- namespace System.Runtime.Remoting.Channels.Tcp
- {
- // After the version, one of the following 16-bit opcodes will appear.
- internal class TcpOperations
- {
- internal const UInt16 Request = 0;
- internal const UInt16 OneWayRequest = 1;
- internal const UInt16 Reply = 2;
- } // TcpOpcodes
- internal class TcpContentDelimiter
- {
- internal const UInt16 ContentLength = 0;
- internal const UInt16 Chunked = 1;
- }
- // These are special header values. (Custom can be used for arbitrary
- // pairs).
- internal class TcpHeaders
- {
- internal const UInt16 EndOfHeaders = 0; // (can appear once at end of headers)
- internal const UInt16 Custom = 1;
- internal const UInt16 StatusCode = 2;
- internal const UInt16 StatusPhrase = 3;
- internal const UInt16 RequestUri = 4;
- internal const UInt16 CloseConnection = 5;
- internal const UInt16 ContentType = 6;
- } // TcpHeaders
- // These are used by special headers (non-Custom) to indicate the format of the data,
- // so that unknown special headers added in the future can be ignored.
- internal class TcpHeaderFormat
- {
- internal const byte Void = 0; // There is no further data.
- internal const byte CountedString = 1; // A single counted string follows.
- internal const byte Byte = 2; // A single byte follows
- internal const byte UInt16 = 3; // A single unsigned 16-bit int follows.
- internal const byte Int32 = 4; // A single 32-bit int follows.
- } // TcpHeaderFormat
- // status codes only apply to the transmission of data itself.
- internal class TcpStatusCode
- {
- internal const UInt16 Success = 0; // data was successfully received
- internal const UInt16 GenericError = 1; // an unknown error occurred
- } // TcpStatusCode
- // string format indicators
- // (strings have the following format on the wire:
- // [format (1-byte)][encoded-size (int32)][string data (encoded-size bytes in length)]
- internal class TcpStringFormat
- {
- internal const byte Unicode = 0;
- internal const byte UTF8 = 1;
- } // TcpStringFormat
- } // namespace System.Runtime.Remoting.Channels.Tcp
TcpWireProtocol.cs
最新推荐文章于 2024-01-24 22:33:04 发布