Syntax
#include <snmp_dpi.h> int DPIget_fd_for_handle( /* get the file descriptor */ int handle); /* for this handle */
Parameters
handle
Return Values
If successful, a positive integer representing the file descriptor associated with the specified handle.
If failure, a negative integer is returned. It indicates the error that occurred. See Return Codes from DPI Transport-Related Functions for a list of possible error codes.
Description
The DPIget_fd_for_handle function is used to obtain the file descriptor for the handle, which was obtained with a DPIconnect_to_agent_TCP() call.
The DPI subagent programmer would use this function to not only wait for DPI requests, but possibly for other TCP/IP events. The programmer may want to do their own select and include for the file descriptor of the DPI connections.
Examples
#include <snmp_dpi.h>#include /* other include files for BSD sockets and such */
int handle;
int fd;
handle = DPIconnect_to_agentTCP("localhost","public");
if (handle < 0) {
printf("Error %d from connect\n",handle);
exit(1);
}
fd = DPIget_fd_for_handle(handle);
if (fd <0) {
printf("Error %d from get_fd\n",fd);
exit(1);
}
Related Information