try {
DataOutputStream dos =
new DataOutputStream(data.getOutputStream());
dos.writeByte(TypeServerConstants.WELCOME);
DataInputStream dis =
new DataInputStream(data.getInputStream());
while (true) {
byte b = dis.readByte();
if (b != TypeServerConstants.GET_STRING_REQUEST) {
System.out.println("Client sent unknown request " + b);
continue;
}
dos.writeByte(TypeServerConstants.GET_STRING_RESPONSE);
dos.writeUTF("Thisisateststring");
dos.flush();
}
} catch (Exception e) {
System.out.println("Client terminating: " + e);
return;
}