/* * Server1.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.DataInputStream; import java.net.ServerSocket; import java.net.Socket; /** * * @author Headley WIlliamson */ public class Server1 { /** * Creates a new instance of Server1 */ public Server1() { } public void startServer() { try { ServerSocket ss = new ServerSocket(51234); Socket socket = ss.accept(); System.out.println("Got a connection"); DataInputStream dis = new DataInputStream(socket.getInputStream()); String text = dis.readUTF(); System.out.println("Received:" + text); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String [] args) { new Server1().startServer(); } }