1 package be
.nikiroo
.utils
.serial
.server
;
3 import java
.io
.IOException
;
4 import java
.net
.Socket
;
5 import java
.net
.UnknownHostException
;
7 import be
.nikiroo
.utils
.Version
;
10 * Class used for the client basic handling.
12 * It represents a single action: a client is expected to only execute one
17 public class ConnectActionClientString
extends ConnectActionClient
{
19 * Create a new {@link ConnectActionClientString} with the current
20 * application version (see {@link Version#getCurrentVersion()}) as the
24 * the socket to bind to
26 * an optional key to encrypt all the communications (if NULL,
27 * everything will be sent in clear text)
29 public ConnectActionClientString(Socket s
, String key
) {
34 * Create a new {@link ConnectActionClientString} with the current
35 * application version (see {@link Version#getCurrentVersion()}) as the
43 * an optional key to encrypt all the communications (if NULL,
44 * everything will be sent in clear text)
47 * in case of I/O error
48 * @throws UnknownHostException
49 * if the IP address of the host could not be determined
50 * @throws IllegalArgumentException
51 * if the port parameter is outside the specified range of valid
52 * port values, which is between 0 and 65535, inclusive
54 public ConnectActionClientString(String host
, int port
, String key
)
56 super(host
, port
, key
);
60 * Create a new {@link ConnectActionClientString}.
67 * an optional key to encrypt all the communications (if NULL,
68 * everything will be sent in clear text)
73 * in case of I/O error
74 * @throws UnknownHostException
75 * if the IP address of the host could not be determined
76 * @throws IllegalArgumentException
77 * if the port parameter is outside the specified range of valid
78 * port values, which is between 0 and 65535, inclusive
80 public ConnectActionClientString(String host
, int port
, String key
,
81 Version version
) throws IOException
{
82 super(host
, port
, key
, version
);
86 * Create a new {@link ConnectActionClientString}.
89 * the socket to bind to
91 * an optional key to encrypt all the communications (if NULL,
92 * everything will be sent in clear text)
96 public ConnectActionClientString(Socket s
, String key
, Version version
) {
97 super(s
, key
, version
);
101 * Send the given object to the server (and return the answer).
106 * @return the answer, which can be NULL
108 * @throws IOException
109 * in case of I/O error
111 public String
send(String data
) throws IOException
{
112 return action
.sendString(data
);