jmce - 1_02

jmce.sim.serial
Class TCPClient

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
                          extended by jmce.sim.serial.TCPClient
All Implemented Interfaces:
java.lang.Runnable, Console, DeviceConsumer<java.lang.Integer>, Hardware, Peripheral

public class TCPClient
extends TCPSocket

Sample client device.

This class connect the socket to specified host and port.

Version:
1.01
Author:
Mario Viara

Field Summary
 
Fields inherited from class jmce.sim.serial.TCPSocket
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
TCPClient()
          Default constructor
TCPClient(int port)
          Constructor with specified port the local host is used.
TCPClient(java.lang.String host, int port)
          Constructor with specified host and port
 
Method Summary
protected  void connect()
          Implemented by sub class.
 java.lang.String getHost()
          Get the host
 void setHost(java.lang.String host)
          Set the host
 java.lang.String toString()
           
 
Methods inherited from class jmce.sim.serial.TCPSocket
close, getPort, setPort, setSocket
 
Methods inherited from class jmce.sim.serial.PolledSerial
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
 
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
 

Constructor Detail

TCPClient

public TCPClient(java.lang.String host,
                 int port)
Constructor with specified host and port


TCPClient

public TCPClient(int port)
Constructor with specified port the local host is used.


TCPClient

public TCPClient()
Default constructor

Method Detail

setHost

public void setHost(java.lang.String host)
Set the host


getHost

public java.lang.String getHost()
Get the host


connect

protected void connect()
                throws java.lang.Exception
Description copied from class: PolledSerial
Implemented by sub class.

Must set the stream to the appropriated value and set connected true.

Specified by:
connect in class PolledSerial
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class AbstractHardware

jmce - 1_02