ER1 User Guide 10-23
ER1Client.java
java TestClient -a <robot IP address>
Here are the command line flags:
> java TestClient -h
Usage:
java TestClient [options]
-a <address> Specify the address of ER1 RCC. Defaults to 127.0.0.1.
-p <port> The port number of the ER1 RCC. Defaults to 9000.
-q Quiet mode. Only errors are printed out.
-h This message.
ER1Client.java
Here is the ER1Client.java file:
/**
* @file ER1Client.java
* @author www.evolution.com
* @author Copyright (C) 2002, Evolution Robotics, Inc.
*/
import java.io.DataOutputStream;
import java.io.BufferedInputStream;
import java.net.Socket;
/**
* Generic socket client class that takes a data listener
* and a protocol handler to process socket data.
*/
public class ER1Client {
String _address = "127.0.0.1";
int _port = 9000;
Socket _socket;
boolean _verbose = true;
DataOutputStream _write_stream = null;
BufferedInputStream _read_stream = null;
Thread _connect_wait = null;
boolean _more_data = false;
public ER1Client(String[] args) {
// Parse command line parameters.
parseCommandLine(args);
}
public Socket getSocket()
{
return _socket;
}
public boolean connect()
{
return _connect(_address, _port);
}
public boolean _connect(String address, int port)
{