Server Client correct socket communication
Hi,
i have a server that works correctly and i have a client. All i need to know is how to make these 2 communicate without having my applet slow down or, not even work at all.
My problem is like this. I can have my server have input.readline() in its run method, (on the whole time )and it dosn't mess up or slow down even if it recieves nothing at all, but if i have the same input.readline() in my applet's run method, and the applet dosn't recieve a message, it screws up the applet and it displays nothing at all. I've been stuck on this for 20 lines for the last 4 days and i'm going bald over it. The following code dosn't work for my applet because it's not recieving any info in the input.readline()
server:
try
{
output.println("hey from the server");
String ln = input.readLine();
if(ln != null){
read_input(ln);
}
}
catch (IOException e) {
System.err.println("server I/O error");
}
finally{
try {
client.close();
}
catch (IOException ee) {
System.err.println("close error");
}}}
client:
try{
output.println("hey from the server");
String ln = input.readLine();
if(ln != null){
read_input(ln);
}
}
catch (IOException e) {
System.err.println("server I/O error");
}
finally{
try {
client.close();
}
catch (IOException ee) {
System.err.println("close error");
}}}

