Info about EJB, SNMP and SUN JDMK package.
The reason that opening sockets is forbidden with EJB is that e.g. your EJB could run in a clustered environment and multiple call to the same EJB might be executed on different hosts which could lead to problems.
Therefore it's the application container's job to manage e.g. JDBC Connections which are guaranteed to work in a clustered environment.