|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ivmaidns.dns.DNSConnection
public final class DNSConnection
Class for DNS TCP connection (client/server-side).
Field Summary | |
---|---|
protected java.io.BufferedInputStream |
in
NOTE: These are input and output streams. |
protected byte[] |
lenBuf
NOTE: Buffer for writing message length. |
protected static java.net.ServerSocket |
listener
NOTE: If listener == null then no listening is performed. |
static int |
MAX_MSG_LEN
NOTE: The maximum length of DNS message. |
protected byte[] |
msgBytes
|
protected int |
msgLen
|
protected java.io.OutputStream |
out
|
static int |
PORT
NOTE: Standard 'domain' service TCP/UDP port. |
protected java.net.Socket |
socket
NOTE: If socket == null then connection is closed. |
Constructor Summary | |
---|---|
DNSConnection()
NOTE: socket is closed initially. |
Method Summary | |
---|---|
void |
close()
NOTE: Must be synchronized outside. |
static DNSRecord[] |
decode(byte[] msgBytes)
NOTE: msgBytes must be ! |
static byte[] |
encode(DNSMsgHeader header,
DNSRecord[] records)
NOTE: header must be ! |
java.net.InetAddress |
getInetAddress()
NOTE: Result ! |
static void |
listen()
NOTE: Start listening (if not already) on DNS port for incoming TCP connections. |
void |
open(java.net.InetAddress server)
NOTE: old connection should be closed. server must be ! |
void |
openIncoming()
NOTE: old connection should be closed. |
byte[] |
receive(boolean wait)
NOTE: If ! |
void |
send(byte[] msgBytes)
NOTE: msgBytes must be ! |
static void |
stopListening()
NOTE: Stop listening on DNS port for incoming TCP connections. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PORT
public static final int MAX_MSG_LEN
protected static java.net.ServerSocket listener
protected java.net.Socket socket
protected byte[] msgBytes
protected int msgLen
protected java.io.BufferedInputStream in
protected java.io.OutputStream out
protected final byte[] lenBuf
Constructor Detail |
---|
public DNSConnection()
Method Detail |
---|
public static void listen() throws java.io.IOException
java.io.IOException
public static void stopListening()
public void openIncoming() throws java.io.IOException
java.io.IOException
public void open(java.net.InetAddress server) throws java.lang.NullPointerException, java.io.IOException
java.lang.NullPointerException
java.io.IOException
public final java.net.InetAddress getInetAddress()
public void send(byte[] msgBytes) throws java.lang.NullPointerException, java.io.IOException
java.lang.NullPointerException
java.io.IOException
public byte[] receive(boolean wait) throws java.io.IOException
java.io.IOException
public void close()
public static final byte[] encode(DNSMsgHeader header, DNSRecord[] records) throws java.lang.NullPointerException
java.lang.NullPointerException
public static final DNSRecord[] decode(byte[] msgBytes) throws java.lang.NullPointerException
java.lang.NullPointerException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |