I've been working on this for about 2 days and I've not progressed at all.
I've made a Java Socket server. The server starts, it reports if someone connects BUT when it comes to sending data to the server it's all built up and can only be dealt with when they have disconnected from the server.
This is what's run when a client connects.
Code:
public void run()
{
input = "";
try
{
DataInputStream in = new DataInputStream(server.getInputStream());
PrintStream out = new PrintStream(server.getOutputStream(), true);
while((input = in.readLine()) != null)
{
System.out.println(input);
}
System.out.println("[" + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()) + "] - Connection closed - ID " + this.clientId);
server.close();
}
catch (IOException ioe)
{
System.out.println("IOException on socket listen: " + ioe);
ioe.printStackTrace();
}
}
I do hope someone can help because I don't know of any Java forums to ask for help.
|