Class UdpSocketChannel
java.lang.Object
org.harctoolbox.harchardware.comm.UdpSocketChannel
This a helper class, to bundle the socket operations in a unified manner.
It can be instantiated, possibly in multiple instances.
It is not meant to be inherited from, or exported.
It should therefore throw low-level exceptions, not HarcHardwareException.
-
Constructor Summary
ConstructorDescriptionUdpSocketChannel
(String hostIp, int portNumber, int timeout, boolean verbose) UdpSocketChannel
(InetAddress inetAddress, int portNumber, int timeout, boolean verbose) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getOut()
boolean
isValid()
static void
void
sendString
(String string) void
setDebug
(int debug) void
setTimeout
(int timeout) void
setVerbose
(boolean verbose)
-
Constructor Details
-
UdpSocketChannel
public UdpSocketChannel(InetAddress inetAddress, int portNumber, int timeout, boolean verbose) throws UnknownHostException, SocketException - Throws:
UnknownHostException
SocketException
-
UdpSocketChannel
public UdpSocketChannel(String hostIp, int portNumber, int timeout, boolean verbose) throws UnknownHostException, SocketException - Throws:
UnknownHostException
SocketException
-
-
Method Details
-
main
-
sendString
- Throws:
IOException
-
close
- Throws:
IOException
-
getOut
-
readString
- Throws:
SocketException
IOException
-
isValid
public boolean isValid() -
setTimeout
- Throws:
SocketException
-
setVerbose
public void setVerbose(boolean verbose) -
setDebug
public void setDebug(int debug)
-