|
Secure iNet Factory | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jscape.inet.nntp.Nntp
com.jscape.inet.nntpssh.NntpSsh
Implements the basic functionality of a NNTP client tunnelling data through a secure SSH connection.
Example Usage:
//
String sshHostname = "news.myserver.com";
String sshUsername = "jsmith";
String sshPassword = "secret";
// create new SshParameters instance
SshParameters sshParams = new SshParameters(sshHostname,sshUsername,sshPassword);
// create new NntpSsh instance
NntpSsh nntp = new NntpSsh(sshParams,"news.myserver.com");
// establish connection and read headers
try
{
nntp.connect();
nntp.setNewsgroup("comp.lang.java.programmer");
// get all headers and print out subject
Enumeration headers = nntp.getArticleHeaders();
while(headers.hasMoreElements())
{
NntpArticleHeader header = (NntpArticleHeader)headers.nextElement();
System.out.println(header.getSubject());
}
// disconnect
nntp.disconnect();
}
catch(Exception e)
{
System.out.println(e);
}
| Field Summary |
| Constructor Summary | |
NntpSsh()
Creates a new NntpSsh instance. |
|
NntpSsh(SshParameters sshParameters,
java.lang.String hostname)
Creates a new NntpSsh instance. |
|
| Method Summary | |
void |
connect()
Connects to NNTP server tunnelling all data through SSH server. |
void |
disconnect()
Disconnects from NNTP server and closes tunnel with SSH server. |
SshParameters |
getSshParameters()
Gets SSH parameters used in establishing connection with SSH server. |
void |
setSshParameters(SshParameters parameters)
Sets SSH parameters used in establishing connection with SSH server. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public NntpSsh()
public NntpSsh(SshParameters sshParameters,
java.lang.String hostname)
sshParameters - the SSH parameters used in establishing a secure connectionhostname - the hostname of NNTP server| Method Detail |
public void connect()
throws NntpException
connect in class NntpNntpException - if I/O or NNTP related error occurspublic void disconnect()
disconnect in class Nntppublic SshParameters getSshParameters()
SshParameterspublic void setSshParameters(SshParameters parameters)
parameters - the SSH parametersSshParameters
|
Secure iNet Factory | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||