1 package be
.nikiroo
.utils
.serial
.server
;
3 import java
.io
.IOException
;
4 import java
.net
.Socket
;
6 import be
.nikiroo
.utils
.Version
;
9 * Class used for the server basic handling.
11 * It represents a single action: a server is expected to execute one action for
16 public class ConnectActionServerString
extends ConnectActionServer
{
18 * Create a new {@link ConnectActionServerString} with the current
19 * application version (see {@link Version#getCurrentVersion()}) as the
23 * the socket to bind to
25 * an optional key to encrypt all the communications (if NULL,
26 * everything will be sent in clear text)
28 public ConnectActionServerString(Socket s
, String key
) {
33 * Create a new {@link ConnectActionServerString}.
36 * the socket to bind to
38 * an optional key to encrypt all the communications (if NULL,
39 * everything will be sent in clear text)
43 public ConnectActionServerString(Socket s
, String key
, Version version
) {
44 super(s
, key
, version
);
48 * Serialise and send the given object to the client.
54 * in case of I/O error
56 public void send(String data
) throws IOException
{
57 action
.sendString(data
);
61 * (Flush the data to the client if needed and) retrieve its answer.
63 * @return the answer if it is available, or NULL if not
66 * in case of I/O error
68 public String
rec() throws IOException
{
69 return action
.recString();