Property | Type | Description | |
---|---|---|---|
BeginTimeoutOp | object | ||
CheckDisposed | void | ||
DoTimeoutOp | object | ||
EndTimeoutOp | object | ||
GetTimeoutValue | int | ||
Init | void | ||
OnTimer | void | ||
SetReceiveTimeout | void | ||
SetSendTimeout | void | ||
SetTimeout | void | ||
SocketEx | System | ||
StartTimeoutTrack | void | ||
StopTimeoutTrack | void |
Method | Description | |
---|---|---|
Accept ( ) : |
Creates the new instance of the BytesRoad.Net.Sockets.SocketEx class which represents newly created connection. Accept method accept incoming connection and create new instance of the SocketEx class for it. The SocketEx should be bound before calling this method thus you need to call BytesRoad.Net.Sockets.SocketEx.Bind and BytesRoad.Net.Sockets.SocketEx.Listen methods first (or their asynchronous versions). |
|
BeginAccept ( AsyncCallback callback, object state ) : IAsyncResult |
Begins an asynchronous operation to accept an incoming connection attempt. BeginAccept method asynchronously accept incoming connection and create new instance of the SocketEx class for it. The SocketEx should be bound before calling this method thus you need to call BytesRoad.Net.Sockets.SocketEx.Bind and BytesRoad.Net.Sockets.SocketEx.Listen methods first (or their asynchronous versions). |
|
BeginBind ( |
Begins an asynchronous binding. The BeginBind method starts an asynchronous binding request. It returns immediately and does not wait for the asynchronous call to complete. The BytesRoad.Net.Sockets.SocketEx.EndBind method is used to retrieve the results of the asynchronous call. It can be called any time after BeginBind; if the asynchronous call has not completed, EndBind will block until it completes. The behavior of the BeginBind method depends on the proxy type specified while instance of the SocketEx class constructed. Table below represents the behavior of the method for different types of proxy server.
|
|
BeginConnect ( |
Begins an asynchronous connection to the remote host by using specified instance of the System.Net.EndPoint class. The BeginConnect method starts an asynchronous request for a remote host connection. It returns immediately and does not wait for the asynchronous call to complete. The BytesRoad.Net.Sockets.SocketEx.EndConnect method is used to retrieve the results of the asynchronous call. It can be called any time after BeginConnect; if the asynchronous call has not completed, EndConnect will block until it completes. |
|
BeginConnect ( string hostName, int port, AsyncCallback callback, object state ) : IAsyncResult |
Begins an asynchronous connection to the remote host by using host name and port number specified. The BeginConnect method starts an asynchronous request for a remote host connection. It returns immediately and does not wait for the asynchronous call to complete. The BytesRoad.Net.Sockets.SocketEx.EndConnect method is used to retrieve the results of the asynchronous call. It can be called any time after BeginConnect; if the asynchronous call has not completed, EndConnect will block until it completes. |
|
BeginReceive ( byte buffer, int offset, int size, AsyncCallback callback, object state ) : IAsyncResult |
Begins an asynchronous receive operation. The BeginReceive method starts an asynchronous receive operation. It returns immediately and does not wait for the asynchronous call to complete. The BytesRoad.Net.Sockets.SocketEx.EndReceive method is used to retrieve the results of the asynchronous call. It can be called any time after BeginReceive; if the asynchronous call has not completed, EndReceive will block until it completes. The receive operation will not completed until the data is available for reading or error occurs. You can use the BytesRoad.Net.Sockets.SocketEx.Available property to determine if data is available for reading. When BytesRoad.Net.Sockets.SocketEx.Available is non-zero, retry the receive operation. |
|
BeginSend ( byte buffer, int offset, int size, AsyncCallback callback, object state ) : IAsyncResult |
Begins an asynchronous send operation. The BeginSend method starts an asynchronous send operation. It returns immediately and does not wait for the asynchronous call to complete. The BytesRoad.Net.Sockets.SocketEx.EndSend method is used to retrieve the results of the asynchronous call. It can be called any time after BeginSend; if the asynchronous call has not completed, EndSend will block until it completes. Send operation will not completed until all of the bytes in the buffer are sent. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the send operation means that the underlying system has had room to buffer your data for a network send. |
|
Bind ( |
Associates a BytesRoad.Net.Sockets.SocketEx with local end point at the proxy server. The behavior of the Bind method depends on the proxy type specified while instance of the SocketEx class constructed. Table below represents the behavior of the method for different types of proxy server. -or- BytesRoad.Net.Sockets.ProxyType.Socks4a-or- BytesRoad.Net.Sockets.ProxyType.Socks5 |
|
Close ( ) : void |
Releases the resources used by the BytesRoad.Net.Sockets.SocketEx. Internally simply calls BytesRoad.Net.Sockets.SocketEx.Dispose. |
|
Connect ( |
Establishes a connection to a remote host by using specified instance of the System.Net.EndPoint class. Connect method will block until the connection with remote host is established or error occurs. |
|
Connect ( string hostName, int hostPort ) : void |
Establishes a connection to a remote host by using host name and port number specified. Connect method will block until the connection with remote host is established or error occurs. |
|
Dispose ( ) : void |
Releases all resources used by the BytesRoad.Net.Sockets.SocketEx. Call Dispose when you are finished using the BytesRoad.Net.Sockets.SocketEx. The Dispose method leaves the SocketEx in an unusable state. After calling Dispose, you must release all references to the SocketEx so the garbage collector can reclaim the memory that the SocketEx was occupying. |
|
EndAccept ( IAsyncResult asyncResult ) : |
Completes the asynchronous operation to accept incoming connection.
|
|
EndBind ( IAsyncResult asyncResult ) : void |
Ends asynchronous binding. EndBind is a blocking method that completes the asynchronous binding operation started in BytesRoad.Net.Sockets.SocketEx.BeginBind. |
|
EndConnect ( IAsyncResult asyncResult ) : void |
Completes the asynchronous connect to remote host. EndConnect is a blocking method that completes the asynchronous connection to remote host started in the BytesRoad.Net.Sockets.SocketEx.BeginConnect method. |
|
EndReceive ( IAsyncResult asyncResult ) : int |
Ends a pending asynchronous receive. EndReceive is a blocking method that completes the asynchronous receive operation started in the BytesRoad.Net.Sockets.SocketEx.BeginReceive method. The EndReceive method will read as much data as is available up to the number of bytes you specified in the size parameter of the BytesRoad.Net.Sockets.SocketEx.BeginReceive method. If the remote host shuts down the BytesRoad.Net.Sockets.SocketEx connection with the BytesRoad.Net.Sockets.SocketEx.Shutdown method, and all available data has been received, the EndReceive method will complete immediately and return zero bytes. |
|
EndSend ( IAsyncResult asyncResult ) : int |
Ends a pending asynchronous send. EndSend is a blocking method that completes the asynchronous send operation started in the BytesRoad.Net.Sockets.SocketEx.BeginSend method. EndSend will block until the requested number of bytes are sent. There is no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the EndSend method means that the underlying system has had room to buffer your data for a network send. |
|
Listen ( int backlog ) : void |
Places a BytesRoad.Net.Sockets.SocketEx in a listening state. Listen causes BytesRoad.Net.Sockets.SocketEx to listen for incoming connection attempts. The backlog parameter specifies the number of incoming connections that can be queued for acceptance. Listen function is meaningful only when called on instance of the BytesRoad.Net.Sockets.SocketEx class which configured not to use any type of proxy servers. That is BytesRoad.Net.Sockets.SocketEx.ProxyType property equals to BytesRoad.Net.Sockets.ProxyType.None. |
|
Receive ( byte buffer ) : int |
Receives data from the remote host and store it in the specified buffer. If no data is available for reading, the Receive method will block until data is available. You can use the BytesRoad.Net.Sockets.SocketEx.Available property to determine if data is available for reading. When BytesRoad.Net.Sockets.SocketEx.Available is non-zero, retry the receive operation. The Receive method will read as much data as is available, up to the size of the buffer. If the remote host shuts down the BytesRoad.Net.Sockets.SocketEx connection with the BytesRoad.Net.Sockets.SocketEx.Shutdown method, and all available data has been received, the Receive method will complete immediately and return zero bytes. |
|
Receive ( byte buffer, int size ) : int |
Receives specified amount of data from the remote host and store it in the supplied buffer. If no data is available for reading, the Receive method will block until data is available. You can use the BytesRoad.Net.Sockets.SocketEx.Available property to determine if data is available for reading. When BytesRoad.Net.Sockets.SocketEx.Available is non-zero, retry the receive operation. The Receive method will read as much data as is available, up to the size of the buffer. If the remote host shuts down the BytesRoad.Net.Sockets.SocketEx connection with the BytesRoad.Net.Sockets.SocketEx.Shutdown method, and all available data has been received, the Receive method will complete immediately and return zero bytes. |
|
Receive ( byte buffer, int offset, int size ) : int |
Receives specified amount of data from the remote host and store it starting from the specified offset in the supplied buffer. If no data is available for reading, the Receive method will block until data is available. You can use the BytesRoad.Net.Sockets.SocketEx.Available property to determine if data is available for reading. When BytesRoad.Net.Sockets.SocketEx.Available is non-zero, retry the receive operation. The Receive method will read as much data as is available, up to the size of the buffer. If the remote host shuts down the BytesRoad.Net.Sockets.SocketEx connection with the BytesRoad.Net.Sockets.SocketEx.Shutdown method, and all available data has been received, the Receive method will complete immediately and return zero bytes. |
|
Send ( byte buffer ) : int |
Sends all data from the specified buffer to the remote host. Send will block until all of the bytes in the buffer are sent. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the Send method means that the underlying system has had room to buffer your data for a network send. |
|
Send ( byte buffer, int size ) : int |
Sends specified amount of data to the remote host. Send will block until all of the bytes in the buffer are sent. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the Send method means that the underlying system has had room to buffer your data for a network send. |
|
Send ( byte buffer, int offset, int size ) : int |
Sends specified amount of data starting from the specified position in the supplied buffer to the remote host. Send will block until all of the bytes in the buffer are sent. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the Send method means that the underlying system has had room to buffer your data for a network send. |
|
Shutdown ( SocketShutdown how ) : void |
Disables sends and receives. Calls System.Net.Sockets.Socket.Shutdown method on a socket which is used in underlying layer for communication with proxy server. |
|
SocketEx ( ) : System |
Initializes new instance of the BytesRoad.Net.Sockets.SocketEx class for direct connection. With this constructor the instance of the BytesRoad.Net.Sockets.SocketEx class would be connected to remote host directly. To force connection through the proxy server you need to use other constructor. |
|
SocketEx ( ProxyType proxyType, string proxyServer, int proxyPort, byte proxyUser, byte proxyPassword ) : System |
Initializes new instance of the BytesRoad.Net.Sockets.SocketEx class for direct connection or connection through the proxy servers. If proxy server doesn't support anonymous users and the proxyUser parameter equals to null (Nothing in Visual Basic) then the BytesRoad.Net.Sockets.SocketEx.Connect method will fail. |
Method | Description | |
---|---|---|
Dispose ( bool disposing ) : void |
Releases the unmanaged resources used by the BytesRoad.Net.Sockets.SocketEx and optionally releases the managed resources. This method is called by the public |
Method | Description | |
---|---|---|
BeginTimeoutOp ( int timeout, |
||
CheckDisposed ( ) : void | ||
DoTimeoutOp ( int timeout, |
||
EndTimeoutOp ( |
||
GetTimeoutValue ( int val, string propName ) : int | ||
Init ( ) : void | ||
OnTimer ( object state ) : void | ||
SetReceiveTimeout ( int timeout ) : void | ||
SetSendTimeout ( int timeout ) : void | ||
SetTimeout ( int timeout ) : void | ||
SocketEx ( |
Used in Accept methods
|
|
StartTimeoutTrack ( int timeout ) : void | ||
StopTimeoutTrack ( |
public BeginAccept ( AsyncCallback callback, object state ) : IAsyncResult | ||
callback | AsyncCallback |
/// The |
state | object | /// An object containing state information for this request. /// |
return | IAsyncResult |
public BeginBind ( |
||
socket |
/// An instance of the |
|
callback | AsyncCallback |
/// The |
state | object | /// An object containing state information for this request. /// |
return | IAsyncResult |
public BeginConnect ( |
||
remoteEP |
/// An instance of the |
|
callback | AsyncCallback |
/// The |
state | object | /// An object containing state information for this request. /// |
return | IAsyncResult |
public BeginConnect ( string hostName, int port, AsyncCallback callback, object state ) : IAsyncResult | ||
hostName | string | The name of the remote host. |
port | int | Port number on the remote host. |
callback | AsyncCallback |
/// The |
state | object | /// An object containing state information for this request. /// |
return | IAsyncResult |
public BeginReceive ( byte buffer, int offset, int size, AsyncCallback callback, object state ) : IAsyncResult | ||
buffer | byte | Buffer to store the received data. |
offset | int | The location in buffer to store the received data. |
size | int | The number of bytes to receive. |
callback | AsyncCallback |
/// The |
state | object | /// An object containing state information for this request. /// |
return | IAsyncResult |
public BeginSend ( byte buffer, int offset, int size, AsyncCallback callback, object state ) : IAsyncResult | ||
buffer | byte | Data to send. |
offset | int | The position in the data buffer at which to begin sending data. |
size | int | The number of bytes to send. |
callback | AsyncCallback |
/// The |
state | object | /// An object containing state information for this request. /// |
return | IAsyncResult |
public Bind ( |
||
socket |
/// An instance of the |
|
return | void |
public Connect ( |
||
remoteEP |
/// An instance of the |
|
return | void |
public Connect ( string hostName, int hostPort ) : void | ||
hostName | string | /// The name of the remote host. /// |
hostPort | int | /// The port number on the remote host. /// |
return | void |
protected Dispose ( bool disposing ) : void | ||
disposing | bool | /// true to release both managed and unmanaged resources; /// false to release only unmanaged resources. /// |
return | void |
public EndAccept ( IAsyncResult asyncResult ) : |
||
asyncResult | IAsyncResult |
/// An
/// |
return |
public EndBind ( IAsyncResult asyncResult ) : void | ||
asyncResult | IAsyncResult |
/// An
/// |
return | void |
public EndConnect ( IAsyncResult asyncResult ) : void | ||
asyncResult | IAsyncResult |
/// An
/// |
return | void |
public EndReceive ( IAsyncResult asyncResult ) : int | ||
asyncResult | IAsyncResult |
/// An
/// |
return | int |
public EndSend ( IAsyncResult asyncResult ) : int | ||
asyncResult | IAsyncResult |
/// An
/// |
return | int |
public Listen ( int backlog ) : void | ||
backlog | int | Lenght of the buffer where incoming connections are queued. |
return | void |
public Receive ( byte buffer ) : int | ||
buffer | byte | /// Buffer to store the received data. /// |
return | int |
public Receive ( byte buffer, int size ) : int | ||
buffer | byte | Buffer to store the received data. |
size | int | The number of bytes to receive. |
return | int |
public Receive ( byte buffer, int offset, int size ) : int | ||
buffer | byte | Buffer to store the received data. |
offset | int | The location in buffer to store the received data. |
size | int | The number of bytes to receive. |
return | int |
public Send ( byte buffer, int size ) : int | ||
buffer | byte | Data to send. |
size | int | The number of bytes to send. |
return | int |
public Send ( byte buffer, int offset, int size ) : int | ||
buffer | byte | Data to send. |
offset | int | The position in the data buffer at which to begin sending data. |
size | int | The number of bytes to send. |
return | int |
public Shutdown ( SocketShutdown how ) : void | ||
how | SocketShutdown |
/// One of the |
return | void |
public SocketEx ( ProxyType proxyType, string proxyServer, int proxyPort, byte proxyUser, byte proxyPassword ) : System | ||
proxyType | ProxyType |
/// Specifies the type of the proxy server to
/// be used for communication with remote end point.
/// One of the |
proxyServer | string | The host name of the proxy server. |
proxyPort | int | The port number of the proxy server. |
proxyUser | byte | /// The user name which would be used with proxy server /// in authentication procedure. /// |
proxyPassword | byte | /// The password which would be used with proxy server /// in authentication procedure. /// |
return | System |