jmce - 1_02

jmce.sim.serial
Class TCPSocket

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.sim.Device<java.lang.Integer>
              extended by jmce.sim.Serial
                  extended by jmce.sim.serial.PolledSerial
                      extended by jmce.sim.serial.TCPSocket
All Implemented Interfaces:
java.lang.Runnable, Console, DeviceConsumer<java.lang.Integer>, Hardware, Peripheral
Direct Known Subclasses:
TCPClient, TCPServer

public abstract class TCPSocket
extends PolledSerial

Base class to implement serial over TCP socket.

The sub class must implements the method connect and when the socket is connected call the method #setSocket(Socket s) after this automatically the data from the socket are sent to the connected device and the data received the device are sent to the socket.

Version:
1.01
Author:
Mario Viara

Field Summary
static int DEFAULT_PORT
           
 
Fields inherited from class jmce.sim.serial.PolledSerial
connected, is, os, rcvd, sent
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Constructor Summary
TCPSocket()
           
 
Method Summary
protected  void close()
          Close the socket and release all the resources.
 int getPort()
          Return the port used by this socket.
 void setPort(int n)
          Set the port used by this socket.
protected  void setSocket(java.net.Socket s)
          Set the sucket.
 
Methods inherited from class jmce.sim.serial.PolledSerial
connect, consume, delay, init, run
 
Methods inherited from class jmce.sim.Serial
print, println, println, putchar
 
Methods inherited from class jmce.sim.Device
addInputConsumer, addInputProducer, addOutputConsumer, addOutputProducer, getConnected, read, readOutput, readyRead, readyReadOutput, readyWrite, removeInputConsumer, removeOutputConsumer, setConnected, write, writeInput
 
Methods inherited from class jmce.sim.AbstractPeripheral
idle, registerCPU, setIdle, setLive
 
Methods inherited from class jmce.sim.AbstractHardware
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmce.sim.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values
Constructor Detail

TCPSocket

public TCPSocket()
Method Detail

setPort

public void setPort(int n)
Set the port used by this socket.


getPort

public int getPort()
Return the port used by this socket.


setSocket

protected void setSocket(java.net.Socket s)
                  throws SIMException
Set the sucket.

Used by sub class to set the socket used for input/output.

Throws:
SIMException

close

protected void close()
Close the socket and release all the resources.

Overrides:
close in class PolledSerial

jmce - 1_02