SnmpKit.SnmpMgr.SocketManager (snmpkit v0.6.6)
Manages shared UDP sockets for SNMP operations.
Provides centralized socket lifecycle management with configurable buffer sizes and health monitoring. Eliminates the need for individual processes to manage their own sockets.
Summary
Functions
Returns a specification to start this module under a supervisor.
Gets detailed UDP buffer utilization metrics.
Gets the local port the socket is bound to.
Gets the shared UDP socket.
Gets socket statistics and health information.
Checks if the socket is healthy and operational.
Starts the SocketManager GenServer.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Gets detailed UDP buffer utilization metrics.
Returns buffer usage, queue lengths, and utilization percentages.
Gets the local port the socket is bound to.
Gets the shared UDP socket.
Returns the socket reference that can be used for sending SNMP packets. The socket is configured with appropriate buffer sizes and options.
Examples
iex> socket = SnmpKit.SnmpMgr.SocketManager.get_socket()
iex> :gen_udp.send(socket, {192, 168, 1, 1}, 161, packet)
Gets socket statistics and health information.
Returns information about buffer usage, packet counts, and socket health metrics.
Checks if the socket is healthy and operational.
Starts the SocketManager GenServer.
Options
:buffer_size
- UDP receive buffer size in bytes (default: 4MB):port
- Local port to bind (default: 0 for OS assignment):name
- Process name (default: MODULE)