de.mud.jta.plugin

Class Socket

Implemented Interfaces:
FilterPlugin, PluginListener, SocketListener

public class Socket
extends Plugin
implements FilterPlugin, SocketListener

The socket plugin acts as the data source for networked operations.

Maintainer: Matthias L. Jugel

Version:
$Id: Socket.java 499 2005-09-29 08:24:54Z leo $
Author:
Matthias L. Jugel, Marcus Mei???ner

Field Summary

protected InputStream
in
protected OutputStream
out
protected String
relay
protected int
relayPort
protected java.net.Socket
socket

Fields inherited from class de.mud.jta.Plugin

bus, id

Constructor Summary

Socket(PluginBus bus, String id)
Create a new socket plugin.

Method Summary

void
connect(String host, int port)
Connect to the host and port passed.
void
disconnect()
Disconnect the socket and close the connection.
FilterPlugin
getFilterSource()
int
read(byte[] b)
void
setFilterSource(FilterPlugin plugin)
void
write(byte[] b)

Methods inherited from class de.mud.jta.Plugin

error, getId

Field Details

in

protected InputStream in

out

protected OutputStream out

relay

protected String relay

relayPort

protected int relayPort

socket

protected java.net.Socket socket

Constructor Details

Socket

public Socket(PluginBus bus,
              String id)
Create a new socket plugin.

Method Details

connect

public void connect(String host,
                    int port)
            throws IOException
Connect to the host and port passed. If the multi relayd (mrelayd) is used to allow connections to any host and the Socket.relay property is configured this method will connect to the relay first, send off the string "relay host port\n" and then the real connection will be published to be online.
Specified by:
connect in interface SocketListener

disconnect

public void disconnect()
            throws IOException
Disconnect the socket and close the connection.
Specified by:
disconnect in interface SocketListener

getFilterSource

public FilterPlugin getFilterSource()
Specified by:
getFilterSource in interface FilterPlugin

read

public int read(byte[] b)
            throws IOException
Specified by:
read in interface FilterPlugin

setFilterSource

public void setFilterSource(FilterPlugin plugin)
Specified by:
setFilterSource in interface FilterPlugin

write

public void write(byte[] b)
            throws IOException
Specified by:
write in interface FilterPlugin