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 * Serialise and send the given object to the client.
39 * in case of I/O error
41 public void send(String data
) throws IOException
{
42 action
.sendString(data
);
46 * (Flush the data to the client if needed and) retrieve its answer.
48 * @return the answer if it is available, or NULL if not
51 * in case of I/O error
53 public String
rec() throws IOException
{
54 return action
.recString();