|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object communication.TCPElement
public class TCPElement
Class used by communication element: manage communications through TCP sockets
Field Summary | |
---|---|
protected int |
localPort
The port on which the local socket server is bound |
protected java.net.ServerSocket |
serverSocket
The local socket server of the element |
Constructor Summary | |
---|---|
TCPElement(int localPort)
|
Method Summary | |
---|---|
int |
getLocalPort()
|
boolean |
initTCP()
Initialize the TCP server socket |
Message |
receiveData()
Wait for the next received message coming from any remote process |
void |
sendData(java.net.InetAddress adr,
int port,
java.lang.Object data)
Send data through the TCP socket. |
void |
setLocalPort(int localPort)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.net.ServerSocket serverSocket
protected int localPort
Constructor Detail |
---|
public TCPElement(int localPort)
localPort
- the port on which the server socket has to be boundMethod Detail |
---|
public void sendData(java.net.InetAddress adr, int port, java.lang.Object data) throws CommunicationException
adr
- IP address of the remote elementport
- port used by the server socket of the remote elementdata
- data to send
CommunicationException
- in case of communication problempublic Message receiveData()
public boolean initTCP()
true
if the server socket has been bound to the required port,
false
otherwise (the TCP element is not usable).public int getLocalPort()
public void setLocalPort(int localPort)
localPort
- the localPort to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |