public class NIOHandler extends Object
Modifier | Constructor and Description |
---|---|
protected |
NIOHandler(SIPTransactionStack sipStack,
NioTcpMessageProcessor messageProcessor) |
Modifier and Type | Method and Description |
---|---|
void |
closeAll()
Close all the cached connections.
|
SocketChannel |
createOrReuseSocket(InetAddress inetAddress,
int port) |
protected SocketChannel |
getSocket(String key) |
protected static String |
makeKey(InetAddress addr,
int port) |
protected static String |
makeKey(String addr,
int port) |
protected void |
putSocket(String key,
SocketChannel sock) |
protected void |
removeSocket(SocketChannel channel) |
protected void |
removeSocket(String key) |
SocketChannel |
sendBytes(InetAddress senderAddress,
InetAddress receiverAddress,
int contactPort,
String transport,
byte[] bytes,
boolean isClient,
NioTcpMessageChannel messageChannel)
Send an array of bytes.
|
void |
stop() |
protected NIOHandler(SIPTransactionStack sipStack, NioTcpMessageProcessor messageProcessor)
protected static String makeKey(InetAddress addr, int port)
protected void putSocket(String key, SocketChannel sock)
protected SocketChannel getSocket(String key)
protected void removeSocket(String key)
protected void removeSocket(SocketChannel channel)
public SocketChannel sendBytes(InetAddress senderAddress, InetAddress receiverAddress, int contactPort, String transport, byte[] bytes, boolean isClient, NioTcpMessageChannel messageChannel) throws IOException
receiverAddress
- -- inet addresscontactPort
- -- port to connect to.transport
- -- tcp or udp.isClient
- -- retry to connect if the other end closed connectionIOException
- -- if there is an IO exception sending message.public void closeAll()
public void stop()
public SocketChannel createOrReuseSocket(InetAddress inetAddress, int port) throws IOException
IOException
Copyright © 2015. All Rights Reserved.