/* * Client1.java * * Created on March 6, 2006, 4:38 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package headley.chat; import java.io.DataOutputStream; import java.net.Socket; /** * * @author Headley WIlliamson */ public class Client1 { /** * Creates a new instance of Client1 */ public Client1() { } public void startClient() { try { Socket socket = new Socket("localhost", 51234); // we are using local host, but we can use any ip addres // localhost means your current desktop you are working on. DataOutputStream dos = new DataOutputStream(socket.getOutputStream()); dos.writeUTF("Are we having fun yet?"); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String [] args) { new Client1().startClient(); } }