I have a problem with the code below. It perfectly works under Windows, but I am getting a timeout under Linux. I am not sure why. Any ideas?
One more thing: Under Liunx It fails when I am testing it using port 1935. However, if I test it with port 110, it works. On Windows it works with both ports (110 & 1935).
Thanks you!
Gustavo
try {
theSocket = new Socket(Address,Port);
theSocket.setSoTimeout(Timeout);
try {
BufferedReader inFromServer = new BufferedReader(
new InputStreamReader(theSocket.getInputStream()));
PrintWriter outToServer = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(theSocket.getOutputStream())), true);
outToServer.println((char)13);
messageReceived = inFromServer.readLine();
TmpPage = messageReceived;
}
catch(IOException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
}else{
ErrorDescription = "ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
}
status = 1;
}
finally {
theSocket.close();
}
}
catch(UnknownHostException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL03 Error in TELNETMonitor Thread (INVALID HOST): "+e.getMessage();
}else{
ErrorDescription = "ERRTEL03 Error in TELNETMonitor Thread (INVALID HOST): "+e.getMessage();
}
status = 1;
}
catch(ConnectException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL04 Error in TELNETMonitor Thread (THE HOST DOESN'T RUN A SERVER ON THE SPECIFIED PORT): "+e.getMessage();
}else{
ErrorDescription = "ERRTEL04 Error in TELNETMonitor Thread (THE HOST DOESN'T RUN A SERVER ON THE SPECIFIED PORT): "+e.getMessage();
}
status = 1;
}
catch(IOException e) {
if (status == 1){
ErrorDescription = ErrorDescription+"ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
}else{
ErrorDescription = "ERRTEL01 Error in TELNETMonitor Thread: "+e.getMessage();
}
status = 1;
}