public class IOHandler extends Object
Modifier | Constructor and Description |
---|---|
protected |
IOHandler(SIPTransactionStack sipStack) |
Modifier and Type | Method and Description |
---|---|
void |
closeAll()
Close all the cached connections.
|
SocketAddress |
getLocalAddressForTcpDst(InetAddress dst,
int dstPort,
InetAddress localAddress,
int localPort)
Creates and binds, if necessary, a socket connected to the specified
destination address and port and then returns its local address.
|
SocketAddress |
getLocalAddressForTlsDst(InetAddress dst,
int dstPort,
InetAddress localAddress,
TLSMessageChannel channel)
Creates and binds, if necessary, a socket connected to the specified
destination address and port and then returns its local address.
|
protected Socket |
getSocket(String key) |
protected static String |
makeKey(InetAddress addr,
int port) |
protected static String |
makeKey(String addr,
int port) |
protected void |
putSocket(String key,
Socket sock) |
protected void |
removeSocket(String key) |
Socket |
sendBytes(InetAddress senderAddress,
InetAddress receiverAddress,
int contactPort,
String transport,
byte[] bytes,
boolean isClient,
MessageChannel messageChannel)
Send an array of bytes.
|
protected IOHandler(SIPTransactionStack sipStack)
protected static String makeKey(InetAddress addr, int port)
protected void removeSocket(String key)
public SocketAddress getLocalAddressForTcpDst(InetAddress dst, int dstPort, InetAddress localAddress, int localPort) throws IOException
dst
- the destination address that the socket would need to connect
to.dstPort
- the port number that the connection would be established with.localAddress
- the address that we would like to bind on (null for the "any"
address).localPort
- the port that we'd like our socket to bind to (0 for a random
port).IOException
- if we fail binding the socketpublic SocketAddress getLocalAddressForTlsDst(InetAddress dst, int dstPort, InetAddress localAddress, TLSMessageChannel channel) throws IOException
dst
- the destination address that the socket would need to connect
to.dstPort
- the port number that the connection would be established
with.localAddress
- the address that we would like to bind on (null for
the "any" address).channel
- the message channel that will be servicing the socketIOException
- if we fail binding the socketpublic Socket sendBytes(InetAddress senderAddress, InetAddress receiverAddress, int contactPort, String transport, byte[] bytes, boolean isClient, MessageChannel 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()
Copyright © 2015. All Rights Reserved.