KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quickserver > net > client > ClientService


1 /*
2  * This file is part of the QuickServer library
3  * Copyright (C) 2003-2005 QuickServer.org
4  *
5  * Use, modification, copying and distribution of this software is subject to
6  * the terms and conditions of the GNU Lesser General Public License.
7  * You should have received a copy of the GNU LGP License along with this
8  * library; if not, you can download a copy from <http://www.quickserver.org/>.
9  *
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 JavaDoc host, int port) throws IOException;
37     /** Returns the connection state of the socket. */
38     public boolean isConnected();
39     /** Closes this socket.*/
40     public void close() throws IOException;
41
42     /** Send binary data */
43     public void sendBinary(byte[] data) throws IOException;
44     /** Send bytes (String) */
45     public void sendBytes(String JavaDoc data) throws IOException;
46     /** Send String appended with \r\n */
47     public void sendString(String JavaDoc data) throws IOException;
48     /** Send object */
49     public void sendObject(Object JavaDoc data) throws IOException;
50
51     /** Read binary data */
52     public byte[] readBinary() throws IOException;
53     /** Read bytes (String) */
54     public String JavaDoc readBytes() throws IOException;
55     /** Read String appended with \r\n */
56     public String JavaDoc readString() throws IOException;
57     /** Read String appended */
58     public Object JavaDoc readObject() throws IOException, ClassNotFoundException JavaDoc;
59
60     /** Returns the Socket class that is used to communicate .*/
61     public Socket getSocket();
62
63 }
Popular Tags