|
IAIK TSP version 2.32 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.net.Socket iaik.tsp.transport.tcpip.TspClientSocket
public class TspClientSocket
This class extends the Socket
to provide sending and
receiving of TimeStampReq
and
TimeStampResp
.
The protocol basically assumes a listener process on a TSA that can accept TSA messages on a well-defined port (default IP port number 318).
In the RFC 3161 are five different response formats defined:
Socket
Constructor Summary | |
---|---|
TspClientSocket(java.net.Proxy proxy)
Creates a new TspClientSocket and connects it to the
specified port number on the named host via the given Proxy. |
|
TspClientSocket(java.lang.String host,
int port,
int timeOut)
Creates a new TspClientSocket and connects it to the
specified port number on the named host. |
Method Summary | |
---|---|
TspTcpIpResponse |
sendRequest(TimeStampReq request)
Sends a TimeStampReq to the specified server and receives a
TspTcpIpResponse . |
Methods inherited from class java.net.Socket |
---|
bind, close, connect, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TspClientSocket(java.lang.String host, int port, int timeOut) throws java.net.UnknownHostException, java.io.IOException
TspClientSocket
and connects it to the
specified port number on the named host.
For instance:
String tsaHost = "..."; int tsaPort = ...; int timeOut = ...; TspClientSocket socket = new TspClientSocket(String tsaHost, tsaPort, timeOut); ... TimeStampReq request = ...; TspTcpIpResponse response = socket.sendRequest(request); ...
host
- The host name.port
- The port number.timeOut
- Enable/disable SO_TIMEOUT with the specified timeout, in
milliseconds. A timeout of zero is interpreted as an infinite
timeout.
java.net.UnknownHostException
- Thrown to indicate that the IP address of a host could not be
determined.
java.io.IOException
- If an I/O error occurs when creating the socket.public TspClientSocket(java.net.Proxy proxy)
TspClientSocket
and connects it to the
specified port number on the named host via the given Proxy.
When using JDK 1.5 or later a Proxy
object may be
used to specify the proxy through which the connection should be
established, e.g.:
String proxyHost = "..."; int proxyPort = ...; SocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort); Proxy proxy = new Proxy(Proxy.Type.SOCKS, proxyAddr); TspClientSocket socket = new TspClientSocket(proxy); String tsaHost = "..."; int tsaPort = ...; InetSocketAddress tspAddr = new InetSocketAddress(tsaHost, tsaPort); socket.connect(tspAddr); ... TimeStampReq request = ...; TspTcpIpResponse response = socket.sendRequest(request); ...
proxy
- The proxy used to connect to the tsa server.Method Detail |
---|
public TspTcpIpResponse sendRequest(TimeStampReq request) throws java.io.IOException, TspTcpIpFormatException, CodingException
TimeStampReq
to the specified server and receives a
TspTcpIpResponse
.
request
- The TimeStampReq
to send.
TspTcpIpResponse
.
java.io.IOException
- Thrown if any I/O exception occurs during transport.
TspTcpIpFormatException
- Thrown if the received message is neither a finalMsgRep nor an errorMsgRep.
CodingException
- Thrown if the received TimeStampResp
could not be parsed.
|
This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |