P
Page
The code below seems simple enough to me but returns the following
error:
Error: java.net.NoRouteToHostException: Operation timed out
Your help is appreciated. The code is run as a Lotus Domino Agent,
but most of the code is lifted straight out of Sun Microsystem's Core
Java 2, Volume II.
import lotus.domino.*;
import java.io.*;
import java.net.*;
public class JavaAgent extends AgentBase {
Database db;
public void NotesMain() {
try {
System.out.println("start.");
final int PORT_HTTP = 80;
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
db = agentContext.getCurrentDatabase();
String strHost;
long timeout = 1000;
strHost = "www.google.com";
System.out.println("variables set.");
try {
Socket s = new Socket ( strHost, PORT_HTTP );
System.out.println("socket open.");
BufferedReader in = new BufferedReader ( new
InputStreamReader ( s.getInputStream ( ) ) );
System.out.println("buffer set.");
boolean more = true;
while (more) {
String line = in.readLine();
if ( line == null ) {
more = false;
s.close();
} else {
System.out.println ( line );
}
}
} catch ( IOException e ) {
System.out.println ( "Error: " + e );
}
System.out.println("done."); // This line for debugging
only.
} catch ( Exception e ) {
System.out.println ( "Error: " + e );
}
}
}
error:
Error: java.net.NoRouteToHostException: Operation timed out
Your help is appreciated. The code is run as a Lotus Domino Agent,
but most of the code is lifted straight out of Sun Microsystem's Core
Java 2, Volume II.
import lotus.domino.*;
import java.io.*;
import java.net.*;
public class JavaAgent extends AgentBase {
Database db;
public void NotesMain() {
try {
System.out.println("start.");
final int PORT_HTTP = 80;
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
db = agentContext.getCurrentDatabase();
String strHost;
long timeout = 1000;
strHost = "www.google.com";
System.out.println("variables set.");
try {
Socket s = new Socket ( strHost, PORT_HTTP );
System.out.println("socket open.");
BufferedReader in = new BufferedReader ( new
InputStreamReader ( s.getInputStream ( ) ) );
System.out.println("buffer set.");
boolean more = true;
while (more) {
String line = in.readLine();
if ( line == null ) {
more = false;
s.close();
} else {
System.out.println ( line );
}
}
} catch ( IOException e ) {
System.out.println ( "Error: " + e );
}
System.out.println("done."); // This line for debugging
only.
} catch ( Exception e ) {
System.out.println ( "Error: " + e );
}
}
}