org.livetribe.slp.spi.net
Class SocketTCPConnector
java.lang.Object
org.livetribe.slp.spi.net.NetworkConnector
org.livetribe.slp.spi.net.TCPConnector
org.livetribe.slp.spi.net.SocketTCPConnector
public class SocketTCPConnector
- extends TCPConnector
- 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, createConnectionPool, 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 |
SocketTCPConnector
public SocketTCPConnector()
getPort
public int getPort()
setPort
public void setPort(int port)
createAcceptors
protected Runnable[] createAcceptors()
throws IOException
- Specified by:
createAcceptors
in class NetworkConnector
- Throws:
IOException
destroyAcceptors
protected void destroyAcceptors()
throws IOException
- Specified by:
destroyAcceptors
in class NetworkConnector
- Throws:
IOException
receive
public byte[] receive(Socket socket)
throws MessageTooBigException,
SocketClosedException,
IOException
- Description copied from class:
TCPConnector
- Reads bytes containing an SLP message.
- Specified by:
receive
in class TCPConnector
- 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 Socket send(byte[] messageBytes,
InetAddress address,
boolean closeSocket)
throws ConnectException,
IOException
- Description copied from class:
TCPConnector
- Sends the bytes containing an SLP message.
- Specified by:
send
in class TCPConnector
- 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 void reply(Socket socket,
byte[] messageBytes)
throws IOException
- Description copied from class:
TCPConnector
- Sends the bytes containing an SLP message in reply to a previos request, via the given socket.
- Specified by:
reply
in class TCPConnector
- 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.