Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. HashMap< String, Socket > users = new HashMap< String, Socket >( );
  2.  
  3. //when a user connects
  4.  
  5. HashMap.put( ip, sock );
  6.  
  7. //To iterate
  8.  
  9. Iterator it = users.entrySet( ).iterator( );
  10. HashMap.Entry item;
  11. String ip;
  12. Socket con;
  13.  
  14. while ( it.hasNext( ) )
  15. {
  16.     item = ( HashMap.Entry ) it.next( );
  17.    
  18.     ip = item.getKey( );
  19.     con = item.getValue( );
  20.    
  21.     //Check if open, etc
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement