KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > coldcore > coloradoftp > connection > ControlConnector


1 package com.coldcore.coloradoftp.connection;
2
3 import java.io.IOException JavaDoc;
4
5 /**
6  * Accepts incoming control connections.
7  *
8  * When connection is accepted on a predefined port, this class configures it,
9  * writes a welcome/reject message into it and adds it to a connection pool which will
10  * serve it till the connection dies.
11  *
12  * Server should not just drop a connection leaving user with no response message. If a
13  * connection must be dropped, it should be poisoned instead, this way the connection
14  * writes out the message to its user and then dies.
15  *
16  * This class must be aware of core's POISONED status. When core is poisoned it is the
17  * responsibility of a connector to not to allow any more incoming connections, so server
18  * can shut down normally.
19  *
20  *
21  * ColoradoFTP - The Open Source FTP Server (http://cftp.coldcore.com)
22  */

23 public interface ControlConnector {
24
25   /** Bing to the port and start listening for incoming connections */
26   public void bind() throws IOException JavaDoc;
27
28
29   /** Unbind from the port and stop listening for incoming connections */
30   public void unbind() throws IOException JavaDoc;
31
32
33   /** Test if connector is bound to the port.
34    * @return TRUE if it is bound, FALSE otherwise
35    */

36   public boolean isBound();
37
38
39   /** Set binding port
40    * @param port Port number
41    */

42   public void setPort(int port);
43
44
45   /** Get binding port
46    * @return Port number
47    */

48   public int getPort();
49 }
50
Popular Tags