package gceschat;

import java.io.IOException;
import java.net.Socket;

public class GreetingClient
{
    private String serverName;
    private int port;
    private Socket client;
    private DataOutputStream Dout;
    private DataInputStream Din;
    
    public GreetingClient(String serverName, int port) throws IOException{
        this.serverName = serverName ;
        this.port = port;
        client = new Socket(serverName,port);
        System.out.println("Connected to" + Client);
        din= new DataInputStream(client.getInputStream());
        dout= new DataOutputStream(client.getOutputStream());
        new Thread(this).start();
       
                
    }
    private void processMessage(String message) throws IOException{
    	
    	dout.writeUTF(message);
    		
    }
    public void run() throws IOException{
    	
    	while(true){
    		
    		String message=din.readUTF();
    		ta.append(message + "\n");
    	}
    	
    	
    }
    
    public static void main(String[] args){
        GreetingClient greetingClient = new GreetingClient("localhost", 8888);
         
       
       

    
    }
}