I'm working on a socket server to instantly receive data from multiple clients, manipulate the data and instantly send it to each of the client connected.
I assumed Java was the simplest as it's the only one I've had minor experiences with.
The problem is, when data is sent, it's stored in the socket until the client disconnects and is then and only then sent to the Java script.
The server runs fine, clients can connect fine but when data is sent it shows nothing until they disconnect then it's all shown as well as a disconnect message.
I assumed Java was the simplest as it's the only one I've had minor experiences with.
The problem is, when data is sent, it's stored in the socket until the client disconnects and is then and only then sent to the Java script.
Code:
DataInputStream in = new DataInputStream(server.getInputStream());
PrintStream out = new PrintStream(server.getOutputStream());
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();
The server runs fine, clients can connect fine but when data is sent it shows nothing until they disconnect then it's all shown as well as a disconnect message.