C# Класс SnmpSharpNet.UdpTransport

IP/UDP transport class.
Наследование: IDisposable
Показать файл Открыть проект

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

Свойство Тип Описание
_isIPv6 bool
_noSourceCheck bool
_socket Socket

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

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

Close network socket

Dispose ( ) : void

Dispose of the class.

Request ( IPAddress peer, int port, byte buffer, int bufferLength, int timeout, int retries ) : byte[]

Make sync request using IP/UDP with request timeouts and retries.

UdpTransport ( bool useV6 ) : System

Constructor. Initializes and binds the Socket class

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

Метод Описание
initSocket ( bool useV6 ) : void

Initialize class socket

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

Метод Описание
AsyncRequestTimerCallback ( object stateInfo ) : void

Internal timer callback. Called by _asyncTimer when SNMP request timeout has expired

ReceiveBegin ( ) : void

Begin async version of ReceiveFrom member of the socket class.

ReceiveFromCallback ( IAsyncResult ar ) : void

Internal callback called as part of Socket.BeginReceiveFrom. Process incoming packets and notify caller of results.

RequestAsync ( IPAddress peer, int port, byte buffer, int bufferLength, int timeout, int retries, SnmpAsyncCallback asyncCallback ) : bool

Begin an async SNMP request

RetryAsyncRequest ( ) : void

Internal retry function. Checks if request has reached maximum number of retries and either resends the request if not reached, or sends request timed-out notification to the caller if maximum retry count has been reached and request has failed.

SendToBegin ( ) : void

Calls async version of the SendTo socket function.

SendToCallback ( IAsyncResult ar ) : void

Callback member called on completion of BeginSendTo send data operation.

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

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

Close network socket
public Close ( ) : void
Результат void

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

Dispose of the class.
public Dispose ( ) : void
Результат void

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

Make sync request using IP/UDP with request timeouts and retries.
Thrown on request timed out. SnmpException.ErrorCode is set to /// SnmpException.RequestTimedOut constant. Thrown when IPv4 address is passed to the v6 socket or vice versa
public Request ( IPAddress peer, int port, byte buffer, int bufferLength, int timeout, int retries ) : byte[]
peer System.Net.IPAddress SNMP agent IP address
port int SNMP agent port number
buffer byte Data to send to the agent
bufferLength int Data length in the buffer
timeout int Timeout in milliseconds
retries int Maximum number of retries. 0 = make a single request with no retry attempts
Результат byte[]

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

Constructor. Initializes and binds the Socket class
public UdpTransport ( bool useV6 ) : System
useV6 bool Set to true if you wish to initialize the transport for IPv6
Результат System

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

Initialize class socket
protected initSocket ( bool useV6 ) : void
useV6 bool Should socket be initialized for IPv6 (true) of IPv4 (false)
Результат void

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

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

Flag showing if class is using IPv6 or IPv4
protected bool _isIPv6
Результат bool

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

Internal variable used to disable host IP address/port number check on received SNMP reply packets. If this option is disabled (default) only replies from the IP address/port number combination to which the request was sent will be accepted as valid packets. This value is set in the AgentParameters class and is only valid for SNMP v1 and v2c requests.
protected bool _noSourceCheck
Результат bool

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

Socket
protected Socket _socket
Результат Socket