查看本类的 API文档回源码主页即时通讯网 - 即时通讯开发者社区!
1   /*
2    * Copyright 2012 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package org.jboss.netty.channel.socket;
17  
18  import java.net.ServerSocket;
19  import java.net.StandardSocketOptions;
20  
21  import org.jboss.netty.channel.ChannelConfig;
22  
23  /**
24   * A {@link ChannelConfig} for a {@link ServerSocketChannel}.
25   *
26   * <h3>Available options</h3>
27   *
28   * In addition to the options provided by {@link ChannelConfig},
29   * {@link ServerSocketChannelConfig} allows the following options in the
30   * option map:
31   *
32   * <table border="1" cellspacing="0" cellpadding="6">
33   * <tr>
34   * <th>Name</th><th>Associated setter method</th>
35   * </tr><tr>
36   * <td>{@code "backlog"}</td><td>{@link #setBacklog(int)}</td>
37   * </tr><tr>
38   * <td>{@code "reuseAddress"}</td><td>{@link #setReuseAddress(boolean)}</td>
39   * </tr><tr>
40   * <td>{@code "receiveBufferSize"}</td><td>{@link #setReceiveBufferSize(int)}</td>
41   * </tr>
42   * </table>
43   */
44  public interface ServerSocketChannelConfig extends ChannelConfig {
45  
46      /**
47       * Gets the backlog value to specify when the channel binds to a local
48       * address.
49       */
50      int getBacklog();
51  
52      /**
53       * Sets the backlog value to specify when the channel binds to a local
54       * address.
55       */
56      void setBacklog(int backlog);
57  
58      /**
59       * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option.
60       */
61      boolean isReuseAddress();
62  
63      /**
64       * Sets the {@link StandardSocketOptions#SO_REUSEADDR} option.
65       */
66      void setReuseAddress(boolean reuseAddress);
67  
68      /**
69       * Gets the {@link StandardSocketOptions#SO_RCVBUF} option.
70       */
71      int getReceiveBufferSize();
72  
73      /**
74       * Sets the {@link StandardSocketOptions#SO_RCVBUF} option.
75       */
76      void setReceiveBufferSize(int receiveBufferSize);
77  
78      /**
79       * Sets the performance preferences as specified in
80       * {@link ServerSocket#setPerformancePreferences(int, int, int)}.
81       */
82      void setPerformancePreferences(int connectionTime, int latency, int bandwidth);
83  }