Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. package unifi.inf.rc.ClaudioBarberini;
  2.  
  3. import java.io.IOException;
  4. import java.net.Inet4Address;
  5. import java.net.InetAddress;
  6. import java.net.ServerSocket;
  7. import java.util.HashMap;
  8.  
  9. public class MyChatServer implements Runnable{
  10.  
  11. private HashMap<String, String> users;
  12. private String address;
  13. private int port;
  14. private ServerSocket ssock;
  15. public MyChatServer(HashMap<String,String> users,String address,int port) {
  16.  
  17. this.users=users;
  18. this.address=address;
  19. this.port=port;
  20. try{
  21. initSocket();
  22. }catch(IOException ex){
  23. System.err.println("Error while initializing Socket:\n\n"+ex.getMessage());
  24. }
  25. }
  26. private void initSocket() throws IOException{
  27. ssock=new ServerSocket(port,50,InetAddress.getByName(address));
  28.  
  29.  
  30. }
  31. @Override
  32. public void run() {
  33. while(true){
  34.  
  35. }
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement