org.livetribe.slp.spi.net
Class TCPConnector
java.lang.Object
org.livetribe.slp.spi.net.NetworkConnector
org.livetribe.slp.spi.net.TCPConnector
- Direct Known Subclasses:
- SocketTCPConnector
public abstract class TCPConnector
- extends NetworkConnector
- Version:
- $Rev: 200 $ $Date: 2006-08-09 14:17:10 +0200 (Wed, 09 Aug 2006) $
Methods inherited from class org.livetribe.slp.spi.net.NetworkConnector |
accept, addMessageListener, clearMessageListeners, createAcceptorPool, createAcceptors, createConnectionPool, destroyAcceptors, doStart, doStop, getInetAddresses, handle, isRunning, notifyMessageListeners, removeMessageListener, setAcceptorPool, setConnectionPool, setInetAddresses, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TCPConnector
public TCPConnector()
isTCPListening
public boolean isTCPListening()
setTCPListening
public void setTCPListening(boolean tcpListening)
getTCPReadTimeout
public int getTCPReadTimeout()
setTCPReadTimeout
public void setTCPReadTimeout(int tcpReadTimeout)
getMaxTCPMessageLength
public int getMaxTCPMessageLength()
setMaxTCPMessageLength
public void setMaxTCPMessageLength(int maxTCPMessageLength)
receive
public abstract byte[] receive(Socket socket)
throws MessageTooBigException,
SocketClosedException,
IOException
- Reads bytes containing an SLP message.
- Parameters:
socket
- The socket to read the message from
- Returns:
- The bytes containing the SLP message
- Throws:
MessageTooBigException
- If the message length (as read from the SLP message header) is greater than
the maximum message length
SocketClosedException
- If the socket is closed by the client before the reading of all message
bytes is completed
IOException
- In case of communication errors
send
public abstract Socket send(byte[] messageBytes,
InetAddress address,
boolean closeSocket)
throws ConnectException,
IOException
- Sends the bytes containing an SLP message.
- Parameters:
messageBytes
- The bytes containing the SLP messageaddress
- The address to send the bytes tocloseSocket
- True if the socket must be closed after the bytes have been sent
- Returns:
- The socket used to send the bytes, or null if the socket has been closed
- Throws:
ConnectException
- If the destination is not listening
IOException
- In case of communication errors
reply
public abstract void reply(Socket socket,
byte[] messageBytes)
throws IOException
- Sends the bytes containing an SLP message in reply to a previos request, via the given socket.
- Parameters:
socket
- The socket where the reply must be written tomessageBytes
- The bytes containing the SLP message
- Throws:
IOException
- In case of communication errors
Copyright © 2006-2012 LiveTribe. All Rights Reserved.