01: /*
02: * This file is part of the QuickServer library
03: * Copyright (C) 2003-2005 QuickServer.org
04: *
05: * Use, modification, copying and distribution of this software is subject to
06: * the terms and conditions of the GNU Lesser General Public License.
07: * You should have received a copy of the GNU LGP License along with this
08: * library; if not, you can download a copy from <http://www.quickserver.org/>.
09: *
10: * For questions, suggestions, bug-reports, enhancement-requests etc.
11: * visit http://www.quickserver.org
12: *
13: */
14:
15: package org.quickserver.net.client;
16:
17: import java.io.*;
18: import java.net.*;
19:
20: /**
21: * Interface that represents client socket services.
22: * @author Akshathkumar Shetty
23: * @since 1.4.7
24: */
25: public interface ClientService {
26: //modes
27: public static final int BLOCKING = 1;
28: public static final int NON_BLOCKING = 2;
29:
30: /**
31: * Returns the client mode.
32: */
33: public int getMode();
34:
35: /** Connects this socket to the server. */
36: public void connect(String host, int port) throws IOException;
37:
38: /** Returns the connection state of the socket. */
39: public boolean isConnected();
40:
41: /** Closes this socket.*/
42: public void close() throws IOException;
43:
44: /** Send binary data */
45: public void sendBinary(byte[] data) throws IOException;
46:
47: /** Send bytes (String) */
48: public void sendBytes(String data) throws IOException;
49:
50: /** Send String appended with \r\n */
51: public void sendString(String data) throws IOException;
52:
53: /** Send object */
54: public void sendObject(Object data) throws IOException;
55:
56: /** Read binary data */
57: public byte[] readBinary() throws IOException;
58:
59: /** Read bytes (String) */
60: public String readBytes() throws IOException;
61:
62: /** Read String appended with \r\n */
63: public String readString() throws IOException;
64:
65: /** Read String appended */
66: public Object readObject() throws IOException,
67: ClassNotFoundException;
68:
69: /** Returns the Socket class that is used to communicate .*/
70: public Socket getSocket();
71:
72: }
|