com.tucows.oxrs.epprtk.rtk.transport
Class EPPTransportTCP
org.omg.CORBA.portable.ObjectImpl
public class EPPTransportTCP
Provides methods necessary to establish connection and to communicate with
an EPP Server using plain socket (no encryption).
protected static int | INT_SZ
|
protected boolean | preset_ - Flag to indicate if the transports socket has been
preset externally.
|
protected BufferedInputStream | reader_from_server_ - Input stream from the server.
|
protected Socket | socket_to_server_ - The socket to the server.
|
protected BufferedOutputStream | writer_to_server_ - Output stream to the server.
|
EPPTransportTCP() - Default Construtor
|
EPPTransportTCP(Socket socket, int timeout) - Construtor with established socket and timeout value
If the timeout value is zero, the default timeout value
from EPPTransportBase is used.
|
EPPTransportTCP(String host_name, int host_port, int timeout) - Construtor with Hostname, Host port and timeout value
If the timeout value is zero, the default timeout value
from EPPTransportBase is used.
|
void | connect() - Connects to the Server using previously set Hostname and port.
|
void | disconnect() - Closes the connection to the Server
|
protected int | readBufferSize(BufferedInputStream in) - Reads 4 bytes and converts them into an integer
|
String | readFromServer() - Reads a complete XML message from the Server.
|
protected byte[] | readInputBuffer(BufferedInputStream in, int inbuf_sz) - Reads inbuf_sz number of bytes from the socket
|
protected void | writeBufferSize(BufferedOutputStream out, int buf_sz) - Converts integer value into 4 bytes and writes the bytes into a socket
|
void | writeToServer(String xml_to_server) - Sends an XML string to the Server
|
connect , disconnect , getEPPHostName , getEPPHostPort , getEPPTimeout , initialize , readFromServer , setEPPHostName , setEPPHostPort , setEPPTimeout , writeToServer |
INT_SZ
protected static final int INT_SZ
preset_
protected boolean preset_
Flag to indicate if the transports socket has been
preset externally.
reader_from_server_
protected BufferedInputStream reader_from_server_
Input stream from the server.
Begotten from the socket.
socket_to_server_
protected Socket socket_to_server_
The socket to the server.
writer_to_server_
protected BufferedOutputStream writer_to_server_
Output stream to the server.
Begotten from the socket.
EPPTransportTCP
public EPPTransportTCP()
Default Construtor
EPPTransportTCP
public EPPTransportTCP(Socket socket,
int timeout)
Construtor with established socket and timeout value
If the timeout value is zero, the default timeout value
from EPPTransportBase is used.
socket
- The Socket to the servertimeout
- The int socket timeout value, in milliseconds
EPPTransportTCP
public EPPTransportTCP(String host_name,
int host_port,
int timeout)
Construtor with Hostname, Host port and timeout value
If the timeout value is zero, the default timeout value
from EPPTransportBase is used.
host_name
- The server Hostnamehost_port
- The server Host porttimeout
- The int socket timeout value, in milliseconds
connect
public void connect()
throws SocketException,
IOException,
UnknownHostException,
EPPTransportException
Connects to the Server using previously set Hostname and port.
If the socket was provided externally, the connection operation is
skipped, but the input and output buffers are still extracted.
The method also sets the SO timeout of the socket regardless
of its origins.
- connect in interface EPPTransportBase
disconnect
public void disconnect()
throws IOException
Closes the connection to the Server
- disconnect in interface EPPTransportBase
readBufferSize
protected int readBufferSize(BufferedInputStream in)
throws Exception
Reads 4 bytes and converts them into an integer
- length of the XML instance and header
readInputBuffer
protected byte[] readInputBuffer(BufferedInputStream in,
int inbuf_sz)
throws Exception
Reads inbuf_sz number of bytes from the socket
writeBufferSize
protected void writeBufferSize(BufferedOutputStream out,
int buf_sz)
throws IOException
Converts integer value into 4 bytes and writes the bytes into a socket
writeToServer
public void writeToServer(String xml_to_server)
throws epp_Exception
Sends an XML string to the Server
- writeToServer in interface EPPTransportBase
epp_Exception
- if there was a socket error in writing to the EPP Server.
The epp_Exception will contain a result with the code epp_Session.RTK_COMMUNICATIONS_FAILURE
Copyright © 2001-2002 - Tucows, Inc., 2003 - LibertyRMS