Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HashMap< String, Socket > users = new HashMap< String, Socket >( );
- //when a user connects
- HashMap.put( ip, sock );
- //To iterate
- Iterator it = users.entrySet( ).iterator( );
- HashMap.Entry item;
- String ip;
- Socket con;
- while ( it.hasNext( ) )
- {
- item = ( HashMap.Entry ) it.next( );
- ip = item.getKey( );
- con = item.getValue( );
- //Check if open, etc
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement