C# Класс TrotiNet.HttpSocket

Communication state between two hosts
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
id int

Защищенные свойства (Protected)

Свойство Тип Описание
LowLevelSocket Socket

Открытые методы

Метод Описание
CloseSocket ( ) : void

Close the internal socket

Dispose ( ) : void

Close the wrapped socket

HttpSocket ( Socket socket ) : System

Wrap a Socket instance into a HttpSocket instance

IsSocketDead ( ) : bool

Returns true if the socket has been closed, or has become unresponsive

ReadAsciiLine ( ) : string

Reads a LF-delimited (or CRLF-delimited) line from the socket, and returns it (without the trailing newline character)

ReadBinary ( ) : uint

Read buffered binary data

A read operation (for instance, ReadAsciiLine) may have loaded the buffer with some data which ended up not being used. If that's the case, then ReadBinary uses it (ReadRaw does not).

Send302 ( ) : void

Send a HTTP 302 redirection over the socket

Send400 ( ) : void

Send a HTTP 400 error over the socket

Send403 ( ) : void

Send a HTTP 403 error over the socket

Send404 ( ) : void

Send a HTTP 404 error over the socket

Send501 ( ) : void

Send a HTTP 501 error over the socket

TunnelChunkedDataTo ( HttpSocket dest ) : void

Tunnel a HTTP-chunked blob of data

The tunneling stops when the last chunk, identified by a size of 0, arrives. The optional trailing entities are also transmitted (but otherwise ignored).

TunnelChunkedDataTo ( MessagePacketHandler mph ) : void

Tunnel a HTTP-chunked blob of data to the specified packet handler

The tunneling stops when the last chunk, identified by a size of 0, arrives. The optional trailing entities are also transmitted (but otherwise ignored).

TunnelDataTo ( HttpSocket dest ) : uint

Transfer data from this socket to the destination socket until this socket closes

TunnelDataTo ( HttpSocket dest, uint nb_bytes ) : uint

Read nb_bytes bytes from the socket, and send it to the destination socket

TunnelDataTo ( MessagePacketHandler mph ) : uint

Transfer data from the socket to the specified packet handler until the socket closes

TunnelDataTo ( MessagePacketHandler mph, byte buffer ) : uint

Sends a buffer to the specified packet handler

TunnelDataTo ( MessagePacketHandler mph, uint nb_bytes ) : uint

Read nb_bytes bytes from the socket, and send it to the specified packet handler

TunnelDataTo ( byte &buffer ) : uint

Fills the buffer with an unknown amount of data from the socket

TunnelDataTo ( byte buffer, uint byte_count ) : uint

Write data from a buffer to the socket

WriteAsciiLine ( string s ) : uint

Write an ASCII string, a CR character, and a LF character to the socket

WriteBinary ( byte b ) : uint

Write an array of bytes to the socket

WriteBinary ( byte b, uint nb_bytes ) : uint

Write the first nb_bytes of b to the socket

WriteBinary ( byte b, uint offset, uint nb_bytes ) : uint

Write nb_bytes of b, starting at offset offset to the socket

Защищенные методы

Метод Описание
ReadRaw ( ) : uint

Read a block of data from the socket; unread data that was in the buffer is dropped

BufferPosition is reset. If there were unread data in the buffer, it's lost.

Приватные методы

Метод Описание
SendHttpError ( string ErrorCodeAndReason ) : void
Trace ( string msg ) : void
TunnelChunkedDataTo ( HttpSocket dest, MessagePacketHandler mph ) : void

Описание методов

CloseSocket() публичный Метод

Close the internal socket
public CloseSocket ( ) : void
Результат void

Dispose() публичный Метод

Close the wrapped socket
public Dispose ( ) : void
Результат void

HttpSocket() публичный Метод

Wrap a Socket instance into a HttpSocket instance
public HttpSocket ( Socket socket ) : System
socket Socket
Результат System

IsSocketDead() публичный Метод

Returns true if the socket has been closed, or has become unresponsive
public IsSocketDead ( ) : bool
Результат bool

ReadAsciiLine() публичный Метод

Reads a LF-delimited (or CRLF-delimited) line from the socket, and returns it (without the trailing newline character)
public ReadAsciiLine ( ) : string
Результат string

ReadBinary() публичный Метод

Read buffered binary data
A read operation (for instance, ReadAsciiLine) may have loaded the buffer with some data which ended up not being used. If that's the case, then ReadBinary uses it (ReadRaw does not).
public ReadBinary ( ) : uint
Результат uint

ReadRaw() защищенный Метод

Read a block of data from the socket; unread data that was in the buffer is dropped
BufferPosition is reset. If there were unread data in the buffer, it's lost.
protected ReadRaw ( ) : uint
Результат uint

Send302() публичный Метод

Send a HTTP 302 redirection over the socket
public Send302 ( ) : void
Результат void

Send400() публичный Метод

Send a HTTP 400 error over the socket
public Send400 ( ) : void
Результат void

Send403() публичный Метод

Send a HTTP 403 error over the socket
public Send403 ( ) : void
Результат void

Send404() публичный Метод

Send a HTTP 404 error over the socket
public Send404 ( ) : void
Результат void

Send501() публичный Метод

Send a HTTP 501 error over the socket
public Send501 ( ) : void
Результат void

TunnelChunkedDataTo() публичный Метод

Tunnel a HTTP-chunked blob of data
The tunneling stops when the last chunk, identified by a size of 0, arrives. The optional trailing entities are also transmitted (but otherwise ignored).
public TunnelChunkedDataTo ( HttpSocket dest ) : void
dest HttpSocket The destination socket
Результат void

TunnelChunkedDataTo() публичный Метод

Tunnel a HTTP-chunked blob of data to the specified packet handler
The tunneling stops when the last chunk, identified by a size of 0, arrives. The optional trailing entities are also transmitted (but otherwise ignored).
public TunnelChunkedDataTo ( MessagePacketHandler mph ) : void
mph MessagePacketHandler
Результат void

TunnelDataTo() публичный Метод

Transfer data from this socket to the destination socket until this socket closes
public TunnelDataTo ( HttpSocket dest ) : uint
dest HttpSocket
Результат uint

TunnelDataTo() публичный Метод

Read nb_bytes bytes from the socket, and send it to the destination socket
public TunnelDataTo ( HttpSocket dest, uint nb_bytes ) : uint
dest HttpSocket
nb_bytes uint
Результат uint

TunnelDataTo() публичный Метод

Transfer data from the socket to the specified packet handler until the socket closes
public TunnelDataTo ( MessagePacketHandler mph ) : uint
mph MessagePacketHandler
Результат uint

TunnelDataTo() публичный Метод

Sends a buffer to the specified packet handler
public TunnelDataTo ( MessagePacketHandler mph, byte buffer ) : uint
mph MessagePacketHandler
buffer byte
Результат uint

TunnelDataTo() публичный Метод

Read nb_bytes bytes from the socket, and send it to the specified packet handler
public TunnelDataTo ( MessagePacketHandler mph, uint nb_bytes ) : uint
mph MessagePacketHandler
nb_bytes uint
Результат uint

TunnelDataTo() публичный Метод

Fills the buffer with an unknown amount of data from the socket
public TunnelDataTo ( byte &buffer ) : uint
buffer byte data from the socket
Результат uint

TunnelDataTo() публичный Метод

Write data from a buffer to the socket
public TunnelDataTo ( byte buffer, uint byte_count ) : uint
buffer byte
byte_count uint
Результат uint

WriteAsciiLine() публичный Метод

Write an ASCII string, a CR character, and a LF character to the socket
public WriteAsciiLine ( string s ) : uint
s string
Результат uint

WriteBinary() публичный Метод

Write an array of bytes to the socket
public WriteBinary ( byte b ) : uint
b byte
Результат uint

WriteBinary() публичный Метод

Write the first nb_bytes of b to the socket
public WriteBinary ( byte b, uint nb_bytes ) : uint
b byte
nb_bytes uint
Результат uint

WriteBinary() публичный Метод

Write nb_bytes of b, starting at offset offset to the socket
public WriteBinary ( byte b, uint offset, uint nb_bytes ) : uint
b byte
offset uint
nb_bytes uint
Результат uint

Описание свойств

LowLevelSocket защищенное свойство

Returns the wrapped socket
protected Socket LowLevelSocket
Результат Socket

id публичное свойство

Socket UID.
public int id
Результат int