|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.metastatic.rsync.v2.SocketClient
A SocketClient connects to rsync servers over TCP port 873. This version of SocketClient connects in the same fashion as rsync-2.* series clients, using protocol version 26.
Field Summary | |
---|---|
protected boolean |
authReqd
Whether or not the server wants authorization. |
protected String |
challenge
The server's authentication challenge. |
protected boolean |
connected
Our connection status. |
protected String |
error
|
protected InputStream |
in
Our input stream from the server. |
static int |
MIN_PROTOCOL_VERSION
The minimum protocol version we support. |
protected LinkedList |
modules
The modules available on the server. |
protected OutputStream |
out
Our output stream to the server. |
static int |
PROTOCOL_VERSION
The protocol version we conform to. |
protected int |
remoteVersion
The server's protocol version. |
protected LinkedList |
serverMessages
The raw list of server messages, possibly the MOTD and the module list. |
protected String |
serverMOTD
The server's message-of-the-day. |
protected Socket |
socket
The socket connected to the remote server. |
Constructor Summary | |
---|---|
protected |
SocketClient(Socket socket,
InputStream in,
OutputStream out)
This class cannot be directly instatiated. |
Method Summary | |
---|---|
boolean |
authenticate(String user,
String pass)
Authenticate the user to the server. |
boolean |
authRequired()
Test if authentication is required. |
static SocketClient |
connect(String host,
int port,
String module)
Connect to host over port, asking for module. |
static SocketClient |
connect(String host,
String module)
Connect to host over port 873, asking for module. |
boolean |
connected()
See if we are connected. |
String |
getError()
Get the last error message the server reported. |
List |
getServerMessages()
Get the messages the server sends during connection. |
void |
serverArgs(String[] sargv)
Send the "server args". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Socket socket
protected InputStream in
protected OutputStream out
protected String serverMOTD
protected LinkedList modules
protected LinkedList serverMessages
protected boolean connected
protected int remoteVersion
protected boolean authReqd
protected String challenge
protected String error
public static final int PROTOCOL_VERSION
public static final int MIN_PROTOCOL_VERSION
Constructor Detail |
protected SocketClient(Socket socket, InputStream in, OutputStream out)
connect(java.lang.String,java.lang.String)
or connect(java.lang.String,int,java.lang.String)
.
Method Detail |
public static SocketClient connect(String host, String module) throws IOException
host
- The host to connect to.module
- The module to use on the host, or can be either
null or "#list" to fetch a listing of
modules.
IOException
public static SocketClient connect(String host, int port, String module) throws IOException
host
- The host to connect to.port
- The port to connect to.module
- The module to use on the host, or can be either
null or "#list" to fetch a listing of
modules.
IOException
public boolean connected()
public List getServerMessages()
public boolean authRequired()
Rsync
object cannot
be obtained if this method returns true.
public boolean authenticate(String user, String pass) throws IOException
user
- The username.pass
- The password.
IOException
public String getError()
public void serverArgs(String[] sargv) throws IOException
sargv
- The server args.
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |