net.jackofalltrades.irc.dcc
Class DccTextConnection

java.lang.Object
  extended bynet.jackofalltrades.irc.BaseConnection
      extended bynet.jackofalltrades.irc.dcc.BaseDccConnection
          extended bynet.jackofalltrades.irc.dcc.DccTextConnection
All Implemented Interfaces:
DccDataListener, java.util.EventListener, java.lang.Runnable

public final class DccTextConnection
extends BaseDccConnection

Implements the DCC spec for text connections (ie. DCC chats).

A DCC request is received from another client as a CTCP message within a PRIVMSG command. The format of the DCC CHAT command is DCC CHAT chat <ip-address> <port>. The ip-address is actually an unsigned integer, in network byte format, representing the IP Address of the machine with which to connect. The unsigned integer must be converted to an InetAddress before connection can be established.

 InetAddress address = InetAddressUtils.toInetAddress(<ip-address>);
 

Since:
0.5-alpha
Version:
$Revision: 1.5 $ $Date: 2003/07/05 15:02:50 $
Author:
Bradley M. Handy

Field Summary
 
Fields inherited from class net.jackofalltrades.irc.BaseConnection
DEFAULT_BUFFER_SIZE, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_WRITE_TIMEOUT, MAX_PORT, MIN_PORT
 
Constructor Summary
DccTextConnection()
          Creates a new DccTextConnection.
DccTextConnection(java.net.InetAddress remoteHost, int port)
          Creates a new DccTextConnection to connect to the specified remote host.
DccTextConnection(java.net.Socket socket)
          Creates a new DccTextConnection connected on the specified java.net.Socket.
DccTextConnection(java.lang.String remoteHost, int port)
          Creates a new DccTextConnection to connect to the specified remote host.
 
Method Summary
protected  void processInput()
          Reads the commands from the , and notifies IrcCommandListeners events.
protected  void wrapInput(java.io.InputStream input)
          Wraps the InputStream in a java.io.Reader.
 
Methods inherited from class net.jackofalltrades.irc.dcc.BaseDccConnection
addDccDataListener, dataPrepared, dataReceived, fireDataReceived, removeDccDataListener, wrapOutput
 
Methods inherited from class net.jackofalltrades.irc.BaseConnection
addConnectionListener, addEventListener, connect, disconnect, getBufferSize, getConnectionTimeout, getEventListeners, getLastException, getPortNumber, getReadWriteTimeout, getRemoteHost, isConnected, removeConnectionListener, removeEventListener, run, setBufferSize, setConnectionTimeout, setLastException, setPortNumber, setReadWriteTimeout, setRemoteHost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DccTextConnection

public DccTextConnection()
Creates a new DccTextConnection.


DccTextConnection

public DccTextConnection(java.net.InetAddress remoteHost,
                         int port)
Creates a new DccTextConnection to connect to the specified remote host.

Parameters:
remoteHost - the java.net.InetAddress of the remote host.
port - the port number on the remote host.
Throws:
java.lang.IllegalArgumentException - if remoteHost is null or if port is not in the range 1 - 65535.

DccTextConnection

public DccTextConnection(java.lang.String remoteHost,
                         int port)
                  throws java.net.UnknownHostException
Creates a new DccTextConnection to connect to the specified remote host.

Parameters:
remoteHost - the name of the remote host.
port - the port number on the server.
Throws:
java.net.UnknownHostException - if the remoteHost cannot be resolved.
java.lang.IllegalArgumentException - if the remoteHost

DccTextConnection

public DccTextConnection(java.net.Socket socket)
Creates a new DccTextConnection connected on the specified java.net.Socket.

Parameters:
socket - the Socket connected to the remote host.
Method Detail

processInput

protected void processInput()
                     throws java.io.IOException
Reads the commands from the , and notifies IrcCommandListeners events.

Specified by:
processInput in class BaseConnection
Throws:
java.io.IOException - if an I/O error occurs.

wrapInput

protected void wrapInput(java.io.InputStream input)
Wraps the InputStream in a java.io.Reader.

Specified by:
wrapInput in class BaseConnection
Parameters:
input - the InputStream from the underlying java.net.Socket.


Copyright © 2002-2003 Jack-of-all-trades Programming Services. All Rights Reserved.