net.jackofalltrades.irc.dcc
Class DccBinaryConnection

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

public final class DccBinaryConnection
extends BaseDccConnection

Implements the DCC spec for binary connections (ie. DCC sends).

A DCC request is received from another client as a CTCP message within a PRIVMSG command. The format of the DCC SEND command is DCC SEND <file-name> <ip-address> <port> [<file-size>]. 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/08/03 21:01:36 $
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
DccBinaryConnection()
          Creates a new DccBinaryConnection.
DccBinaryConnection(java.net.InetAddress remoteHost, int port)
          Creates a new DccBinaryConnection to connect to the specified remote host.
DccBinaryConnection(java.net.Socket socket)
          Creates a new DccBinaryConnection connected on the specified java.net.Socket.
DccBinaryConnection(java.lang.String remoteHost, int port)
          Creates a new DccBinaryConnection 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

DccBinaryConnection

public DccBinaryConnection()
Creates a new DccBinaryConnection.


DccBinaryConnection

public DccBinaryConnection(java.net.InetAddress remoteHost,
                           int port)
Creates a new DccBinaryConnection 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.

DccBinaryConnection

public DccBinaryConnection(java.lang.String remoteHost,
                           int port)
                    throws java.net.UnknownHostException
Creates a new DccBinaryConnection 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

DccBinaryConnection

public DccBinaryConnection(java.net.Socket socket)
Creates a new DccBinaryConnection 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.