Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package unifi.inf.rc.ClaudioBarberini;
- import java.io.IOException;
- import java.net.Inet4Address;
- import java.net.InetAddress;
- import java.net.ServerSocket;
- import java.util.HashMap;
- public class MyChatServer implements Runnable{
- private HashMap<String, String> users;
- private String address;
- private int port;
- private ServerSocket ssock;
- public MyChatServer(HashMap<String,String> users,String address,int port) {
- this.users=users;
- this.address=address;
- this.port=port;
- try{
- initSocket();
- }catch(IOException ex){
- System.err.println("Error while initializing Socket:\n\n"+ex.getMessage());
- }
- }
- private void initSocket() throws IOException{
- ssock=new ServerSocket(port,50,InetAddress.getByName(address));
- }
- @Override
- public void run() {
- while(true){
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement