function::tcpmib_remote_port - Linux
Overview
function tcpmib_remote_port is a Net-SNMP library function that extracts the remote TCP port number from a given TargetInfo pointer.
Syntax
int tcpmib_remote_port(const void *vp,
size_t length);
Parameters
- vp: a pointer to the TargetInfo structure.
- length: the length of the TargetInfo structure.
Options/Flags
This function does not have any options or flags.
Examples
/* Sample usage of tcpmib_remote_port */
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
int main() {
struct targetInfo *target;
int port;
target = (struct targetInfo *) malloc(sizeof(struct targetInfo));
target->remote_port = 80;
port = tcpmib_remote_port(target, sizeof(struct targetInfo));
printf ("Remote port: %d\n", port);
free(target);
return 0;
}
Common Issues
None to report.
Integration
This function is typically used in conjunction with other Net-SNMP library functions to manage and monitor TCP/IP networks.
Related Commands
- tcpmib_remote_address: extracts the remote TCP address from a given TargetInfo pointer.
- tcpmib_local_port: extracts the local TCP port number from a given TargetInfo pointer.
- tcpmib_local_address: extracts the local TCP address from a given TargetInfo pointer.