I am making a server client system in which the client will write a message to the server and the server will save it as a string and print it in the console. But when ever the System tries to read the line I get "PrintStream error" in the console. No errors or anything. I am reading the string, on the server, with:
DataInputStream inFromClient = new DataInputStream(socket.getInputStream());
String connectReason = inFromClient.readUTF();
And I am sending the string from the client like this:
clientSocket = new TcpClient(Host, Port);
Stream = clientSocket.GetStream();
outToServer = new StreamWriter(Stream);
Why am I getting that error? They connect without error and when I get to that line I get the "PrintStream Error".