proper.net
Class Data

java.lang.Object
  extended by proper.core.ProperObject
      extended by proper.net.Data
All Implemented Interfaces:
ProperInterface

public class Data
extends ProperObject

This class can send data to a receiver and also receive it (it is waiting until it's getting something, i.e. it is blocking).

Version:
$Revision: 1.2 $
Author:
FracPete

Field Summary
 
Fields inherited from interface proper.core.ProperInterface
VERSION
 
Constructor Summary
Data()
          initializes the object
 
Method Summary
 java.lang.Exception getLastException()
          returns the last Exception, can be NULL
 java.net.ServerSocket getServerSocket()
          returns the current serversocket, can be NULL
 java.lang.String receive(int port)
          waits for data on the given port
 java.lang.String receive(int port, int timeout)
          waits for data on the given port (socket waits for timeout msecs, where 0 is inifinite)
 boolean send(java.net.InetSocketAddress addr, java.lang.String data)
          sends the data in a non-silent way, i.e.
 boolean send(java.net.InetSocketAddress addr, java.lang.String data, boolean silent)
          sends the data, can suppress the exceptions with silent=TRUE
 
Methods inherited from class proper.core.ProperObject
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Data

public Data()
initializes the object

Method Detail

send

public boolean send(java.net.InetSocketAddress addr,
                    java.lang.String data)
sends the data in a non-silent way, i.e. it prints the exceptions


send

public boolean send(java.net.InetSocketAddress addr,
                    java.lang.String data,
                    boolean silent)
sends the data, can suppress the exceptions with silent=TRUE


getServerSocket

public java.net.ServerSocket getServerSocket()
returns the current serversocket, can be NULL


receive

public java.lang.String receive(int port)
waits for data on the given port


receive

public java.lang.String receive(int port,
                                int timeout)
waits for data on the given port (socket waits for timeout msecs, where 0 is inifinite)


getLastException

public java.lang.Exception getLastException()
returns the last Exception, can be NULL