|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nist.javax.sip.stack.IOHandler
public class IOHandler
Low level Input output to a socket. Caches TCP connections and takes care of re-connecting to the remote party if the other end drops the connection
Constructor Summary | |
---|---|
protected |
IOHandler(SIPTransactionStack sipStack)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected IOHandler(SIPTransactionStack sipStack)
Method Detail |
---|
protected static String makeKey(InetAddress addr, int port)
protected static String makeKey(String addr, int port)
protected void putSocket(String key, Socket sock)
protected Socket getSocket(String key)
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 socket
IOException
- 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 connection
IOException
- -- if there is an IO exception sending message.public void closeAll()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |