This class implements extended socket, provides usefull methods for reading and writing data to socket.
| C# | Visual Basic | Managed C++ |
public class SocketEx : IDisposable
Public Class SocketEx _ Implements IDisposable
public ref class SocketEx : IDisposable
| All Members | Constructors | Methods | Properties | Fields | Events |
| Icon | Member | Description |
|---|---|---|
| SocketExNew() |
Default constructor.
| |
| SocketExNew(Socket) |
Socket wrapper. NOTE: You must pass connected socket here !
| |
| Accept(Boolean) |
TODO:
| |
| BeginReadLine(Stream, Int32, Object, SocketCallBack) |
Begins reading line from socket asynchrounously.
If maximum allowed line length is exceeded line is read to end, but isn't stored to buffer and exception
is thrown after line reading.
| |
| BeginReadPeriodTerminated(Stream, Int32, Object, SocketCallBack) |
Begins reading period terminated data. The data is terminated by a line containing only a period, that is,
the character sequence "<CRLF>.<CRLF>".
When a line of text is received, it checks the line. If the line is composed of a single period,
it is treated as the end of data indicator. If the first character is a period and there are
other characters on the line, the first character is deleted.
If maximum allowed data length is exceeded data is read to end, but isn't stored to stream and exception
is thrown after data reading.
| |
| BeginReadSpecifiedLength(Stream, Int32, Object, SocketCallBack) |
Begins reading specified amount of data from socket asynchronously.
| |
| BeginWrite(Stream, Object, SocketCallBack) |
Begins writing specified data to socket.
| |
| BeginWriteLine(String, SocketCallBack) |
Begins specified line sending to socket asynchronously.
| |
| BeginWriteLine(String, Object, SocketCallBack) |
Begins specified line sending to socket asynchronously.
| |
| BeginWritePeriodTerminated(Stream, Object, SocketCallBack) |
Begins writing period terminated data to socket. The data is terminated by a line containing only a period, that is,
the character sequence "<CRLF>.<CRLF>". Before sending a line of text, check the first
character of the line.If it is a period, one additional period is inserted at the beginning of the line.
| |
| BeginWritePeriodTerminated(Stream, Boolean, Object, SocketCallBack) |
Begins writing period terminated data to socket. The data is terminated by a line containing only a period, that is,
the character sequence "<CRLF>.<CRLF>". Before sending a line of text, check the first
character of the line.If it is a period, one additional period is inserted at the beginning of the line.
| |
| Bind(EndPoint) |
Associates a Socket with a local endpoint.
| |
| Connect(IPEndPoint) |
Connects to the specified host.
| |
| Connect(IPEndPoint, Boolean) |
Connects to the specified host.
| |
| Connect(String, Int32) |
Connects to the specified host.
| |
| Connect(String, Int32, Boolean) |
Connects to the specified host.
| |
| Connected |
Gets if socket is connected.
| |
| Disconnect() |
Disconnects socket.
| |
| Dispose() |
Clean up any resouces being used.
| |
| Encoding |
Gets or sets socket default encoding.
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode() | Serves as a hash function for a particular type. GetHashCode() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |
| GetType() | Gets the Type of the current instance. (Inherited from Object.) | |
| LastActivity |
Gets when was last socket(read or write) activity.
| |
| Listen(Int32) |
Places a Socket in a listening state.
| |
| LocalEndPoint |
Gets the local endpoint.
| |
| Logger |
Gets or sets logging source. If this is setted, reads/writes are logged to it.
| |
| MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| RawSocket |
Gets raw uderlaying socket.
| |
| ReadByte() |
Reads byte from socket. Returns readed byte or -1 if socket is shutdown and tehre is no more data available.
| |
| ReadedCount |
Gets how many bytes are readed through this socket.
| |
| ReadLine() |
Reads line from socket. Maximum line length is 4000 bytes. NOTE: CRLF isn't written to destination stream.
If maximum allowed line length is exceeded line is read to end, but isn't stored to buffer and exception
is thrown after line reading.
| |
| ReadLine(Int32) |
Reads line from socket.NOTE: CRLF isn't written to destination stream.
If maximum allowed line length is exceeded line is read to end, but isn't stored to buffer and exception
is thrown after line reading.
| |
| ReadLine(Stream, Int32) |
Reads line from socket and stores it to specified stream. NOTE: CRLF isn't written to destination stream.
If maximum allowed line length is exceeded line is read to end, but isn't stored to buffer and exception
is thrown after line reading.
| |
| ReadLineByte(Int32) |
Reads line from socket.NOTE: CRLF isn't written to destination stream.
If maximum allowed line length is exceeded line is read to end, but isn't stored to buffer and exception
is thrown after line reading.
| |
| ReadPeriodTerminated(Int32) |
Reads period terminated string. The data is terminated by a line containing only a period, that is,
the character sequence "<CRLF>.<CRLF>".
When a line of text is received, it checks the line. If the line is composed of a single period,
it is treated as the end of data indicator. If the first character is a period and there are
other characters on the line, the first character is deleted.
If maximum allowed data length is exceeded data is read to end, but isn't stored to buffer and exception
is thrown after data reading.
| |
| ReadPeriodTerminated(Stream, Int32) |
Reads period terminated data. The data is terminated by a line containing only a period, that is,
the character sequence "<CRLF>.<CRLF>".
When a line of text is received, it checks the line. If the line is composed of a single period,
it is treated as the end of data indicator. If the first character is a period and there are
other characters on the line, the first character is deleted.
If maximum allowed data length is exceeded data is read to end, but isn't stored to stream and exception
is thrown after data reading.
| |
| ReadSpecifiedLength(Int32, Stream) |
Reads specified length of data from socket and store to specified stream.
| |
| RemoteEndPoint |
Gets the remote endpoint.
| |
| SendTo(Byte[](), EndPoint) |
Sends data to the specified end point.
| |
| Shutdown(SocketShutdown) |
Shutdowns socket.
| |
| SSL |
Gets if socket is connected via SSL.
| |
| SwitchToSSL(X509Certificate) |
Switches socket to SSL mode. Throws excpetion is socket is already in SSL mode.
| |
| SwitchToSSL_AsClient() |
Switches socket to SSL mode. Throws excpetion is socket is already in SSL mode.
| |
| ToString() | (Inherited from Object.) | |
| Write(String) |
Writes specified data to socket.
| |
| Write(Byte[]()) |
Writes specified data to socket.
| |
| Write(Byte[](), Int32, Int32) |
Writes specified data to socket.
| |
| Write(Stream) |
Writes specified data to socket.
| |
| Write(Stream, Int64) |
Writes specified data to socket.
| |
| WriteLine(String) |
Writes specified line to socket. If line isn't CRLF terminated, CRLF is added automatically.
| |
| WriteLine(Byte[]()) |
Writes specified line to socket. If line isn't CRLF terminated, CRLF is added automatically.
| |
| WritePeriodTerminated(String) |
Writes period terminated string to socket. The data is terminated by a line containing only a period, that is,
the character sequence "<CRLF>.<CRLF>". Before sending a line of text, check the first
character of the line.If it is a period, one additional period is inserted at the beginning of the line.
| |
| WritePeriodTerminated(Stream) |
Writes period terminated data to socket. The data is terminated by a line containing only a period, that is,
the character sequence "<CRLF>.<CRLF>". Before sending a line of text, check the first
character of the line.If it is a period, one additional period is inserted at the beginning of the line.
| |
| WrittenCount |
Gets how many bytes are written through this socket.
|
| Object | |
| SocketEx | |
Assembly: LumiSoft.Net Version: 2.0.2636.18419 (Module: LumiSoft.Net)