public class UDPSocketWrapper extends java.lang.Object implements SocketWrapper
| Constructor and Description |
|---|
UDPSocketWrapper(java.net.InetSocketAddress address,
boolean isJavaObjectExpected)
Constructor for client.
|
UDPSocketWrapper(int port,
boolean isJavaObjectExpected)
Constructor for the server socket.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
java.net.InetAddress |
getInetAddress()
This method returns the address of the socket that is bound to this socket.
|
boolean |
isClosed()
This method returns true if the socket has been closed.
|
java.lang.Object |
readObject()
This method reads the object from the socket.
|
java.lang.Object |
readObject(int numberOfSeconds)
This method reads an object from the socket.
|
void |
writeObject(java.lang.Object obj)
This method sends an object through the socket.
|
public UDPSocketWrapper(java.net.InetSocketAddress address,
boolean isJavaObjectExpected)
throws java.lang.Exception
address - an InetSocketAddressisJavaObjectExpected - true if the caller is a Java applicationjava.lang.Exceptionpublic UDPSocketWrapper(int port,
boolean isJavaObjectExpected)
throws java.lang.Exception
port - the port to listen to.isJavaObjectExpected - true if the caller is a Java application.java.net.SocketExceptionjava.lang.Exceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic boolean isClosed()
SocketWrapperisClosed in interface SocketWrapperpublic java.lang.Object readObject()
throws java.lang.Exception
SocketWrapperreadObject in interface SocketWrapperjava.lang.Exceptionpublic java.lang.Object readObject(int numberOfSeconds)
throws java.lang.Exception
SocketWrapperreadObject in interface SocketWrappernumberOfSeconds - number of seconds to wait before throwing a TimeoutExceptionjava.lang.Exceptionpublic void writeObject(java.lang.Object obj)
throws java.io.IOException
SocketWrapperwriteObject in interface SocketWrapperobj - the object to be sent.java.io.IOExceptionpublic java.net.InetAddress getInetAddress()
SocketWrappergetInetAddress in interface SocketWrapper