View Javadoc
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 io.netty.channel.socket;
17  
18  import io.netty.buffer.ByteBufAllocator;
19  import io.netty.channel.ChannelConfig;
20  import io.netty.channel.MessageSizeEstimator;
21  import io.netty.channel.RecvByteBufAllocator;
22  import io.netty.channel.WriteBufferWaterMark;
23  
24  import java.net.ServerSocket;
25  import java.net.StandardSocketOptions;
26  
27  /**
28   * A {@link ChannelConfig} for a {@link ServerSocketChannel}.
29   *
30   * <h3>Available options</h3>
31   *
32   * In addition to the options provided by {@link ChannelConfig},
33   * {@link ServerSocketChannelConfig} allows the following options in the
34   * option map:
35   *
36   * <table border="1" cellspacing="0" cellpadding="6">
37   * <tr>
38   * <th>Name</th><th>Associated setter method</th>
39   * </tr><tr>
40   * <td>{@code "backlog"}</td><td>{@link #setBacklog(int)}</td>
41   * </tr><tr>
42   * <td>{@code "reuseAddress"}</td><td>{@link #setReuseAddress(boolean)}</td>
43   * </tr><tr>
44   * <td>{@code "receiveBufferSize"}</td><td>{@link #setReceiveBufferSize(int)}</td>
45   * </tr>
46   * </table>
47   */
48  public interface ServerSocketChannelConfig extends ChannelConfig {
49  
50      /**
51       * Gets the backlog value to specify when the channel binds to a local
52       * address.
53       */
54      int getBacklog();
55  
56      /**
57       * Sets the backlog value to specify when the channel binds to a local
58       * address.
59       */
60      ServerSocketChannelConfig setBacklog(int backlog);
61  
62      /**
63       * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option.
64       */
65      boolean isReuseAddress();
66  
67      /**
68       * Sets the {@link StandardSocketOptions#SO_REUSEADDR} option.
69       */
70      ServerSocketChannelConfig setReuseAddress(boolean reuseAddress);
71  
72      /**
73       * Gets the {@link StandardSocketOptions#SO_RCVBUF} option.
74       */
75      int getReceiveBufferSize();
76  
77      /**
78       * Gets the {@link StandardSocketOptions#SO_SNDBUF} option.
79       */
80      ServerSocketChannelConfig setReceiveBufferSize(int receiveBufferSize);
81  
82      /**
83       * Sets the performance preferences as specified in
84       * {@link ServerSocket#setPerformancePreferences(int, int, int)}.
85       */
86      ServerSocketChannelConfig setPerformancePreferences(int connectionTime, int latency, int bandwidth);
87  
88      @Override
89      ServerSocketChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
90  
91      @Override
92      @Deprecated
93      ServerSocketChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead);
94  
95      @Override
96      ServerSocketChannelConfig setWriteSpinCount(int writeSpinCount);
97  
98      @Override
99      ServerSocketChannelConfig setAllocator(ByteBufAllocator allocator);
100 
101     @Override
102     ServerSocketChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator);
103 
104     @Override
105     ServerSocketChannelConfig setAutoRead(boolean autoRead);
106 
107     @Override
108     ServerSocketChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
109 
110     @Override
111     ServerSocketChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
112 
113     @Override
114     ServerSocketChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark);
115 
116     @Override
117     ServerSocketChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark);
118 
119 }