Search code examples
javasnmpsnmp4j

How can I get my Application bound to port 161?


I'm working on a Java Project where I need to Simulate a Printer. Clients of the Printer send SNMP messages to the Printer. Printer should have SNMP Agent running on port 161. Since, port 161 is a well known port, I'm unable to use that port. How can I get my Application bound to port 161?


Solution

  • The problem is not because this is a well known port but because it is a reserved port (lower than 1024). On many operating systems, reserved ports can be bound by the superuser. So just run your java VM as root.