diff --git a/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java
index 70ca701234..b09b4a46c0 100644
--- a/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java
+++ b/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java
@@ -26,6 +26,8 @@ import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelPipeline;
/**
+ * A {@link ChannelFactory} which creates a client-side {@link SocketChannel}.
+ *
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
*
diff --git a/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java
index e59235fad5..ae2e7e04e9 100644
--- a/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java
+++ b/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java
@@ -31,12 +31,23 @@ import org.jboss.netty.channel.ChannelException;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.util.ConversionUtil;
+/**
+ * The default {@link ServerSocketChannelConfig} implementation.
+ *
+ * @author The Netty Project (netty-dev@lists.jboss.org)
+ * @author Trustin Lee (tlee@redhat.com)
+ *
+ * @version $Rev$, $Date$
+ */
public class DefaultServerSocketChannelConfig implements ServerSocketChannelConfig {
private final ServerSocket socket;
private volatile int backlog;
private volatile ChannelPipelineFactory pipelineFactory;
+ /**
+ * Creates a new instance.
+ */
public DefaultServerSocketChannelConfig(ServerSocket socket) {
if (socket == null) {
throw new NullPointerException("socket");
@@ -50,6 +61,10 @@ public class DefaultServerSocketChannelConfig implements ServerSocketChannelConf
}
}
+ /**
+ * Sets an individual option. You can override this method to support
+ * additional configuration parameters.
+ */
protected boolean setOption(String key, Object value) {
if (key.equals("receiveBufferSize")) {
setReceiveBufferSize(ConversionUtil.toInt(value));
diff --git a/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java
index 5884718563..c10cf5dd01 100644
--- a/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java
+++ b/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java
@@ -31,11 +31,23 @@ import org.jboss.netty.channel.ChannelException;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.util.ConversionUtil;
+/**
+ * The default {@link SocketChannelConfig} implementation.
+ *
+ * @author The Netty Project (netty-dev@lists.jboss.org)
+ * @author Trustin Lee (tlee@redhat.com)
+ *
+ * @version $Rev$, $Date$
+ *
+ */
public class DefaultSocketChannelConfig implements SocketChannelConfig {
private final Socket socket;
private volatile int connectTimeoutMillis = 10000; // 10 seconds
+ /**
+ * Creates a new instance.
+ */
public DefaultSocketChannelConfig(Socket socket) {
if (socket == null) {
throw new NullPointerException("socket");
@@ -49,6 +61,10 @@ public class DefaultSocketChannelConfig implements SocketChannelConfig {
}
}
+ /**
+ * Sets an individual option. You can override this method to support
+ * additional configuration parameters.
+ */
protected boolean setOption(String key, Object value) {
if (key.equals("receiveBufferSize")) {
setReceiveBufferSize(ConversionUtil.toInt(value));
diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java
index 98a86a7ce6..92ebcd032f 100644
--- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java
+++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java
@@ -27,6 +27,9 @@ import java.net.InetSocketAddress;
import org.jboss.netty.channel.Channel;
/**
+ * A server-side TCP/IP socket {@link Channel} which accepts incoming TCP/IP
+ * connections.
+ *
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
*
diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java
index 4179d2c611..26c7921a7e 100644
--- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java
+++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java
@@ -22,14 +22,55 @@
*/
package org.jboss.netty.channel.socket;
+import java.net.ServerSocket;
+
import org.jboss.netty.channel.ChannelConfig;
+/**
+ * A {@link ChannelConfig} for a {@link ServerSocketChannel}.
+ *
+ * @author The Netty Project (netty-dev@lists.jboss.org)
+ * @author Trustin Lee (tlee@redhat.com)
+ *
+ * @version $Rev$, $Date$
+ */
public interface ServerSocketChannelConfig extends ChannelConfig {
+
+ /**
+ * Gets the backlog value to specify when the channel binds to a local
+ * address.
+ */
int getBacklog();
+
+ /**
+ * Sets the backlog value to specify when the channel binds to a local
+ * address.
+ */
void setBacklog(int backlog);
+
+ /**
+ * Gets the {@code SO_REUSEADDR} option.
+ */
boolean isReuseAddress();
+
+ /**
+ * Sets the {@code SO_REUSEADDR} option.
+ */
void setReuseAddress(boolean reuseAddress);
+
+ /**
+ * Gets the {@code SO_RCVBUF} option.
+ */
int getReceiveBufferSize();
+
+ /**
+ * Sets the {@code SO_RCVBUF} option.
+ */
void setReceiveBufferSize(int receiveBufferSize);
+
+ /**
+ * Sets the performance preferences as specified in
+ * {@link ServerSocket#setPerformancePreferences(int, int, int)}.
+ */
void setPerformancePreferences(int connectionTime, int latency, int bandwidth);
}
diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java
index 62632eabbc..34deb5b9f8 100644
--- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java
+++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java
@@ -26,6 +26,8 @@ import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelPipeline;
/**
+ * A {@link ChannelFactory} which creates a {@link ServerSocketChannel}.
+ *
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
*
diff --git a/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java
index a0c61ec01e..3e62ad70a6 100644
--- a/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java
+++ b/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java
@@ -27,6 +27,9 @@ import java.net.InetSocketAddress;
import org.jboss.netty.channel.Channel;
/**
+ * A TCP/IP socket {@link Channel} which was either accepted by
+ * {@link ServerSocketChannel} or created by {@link ClientSocketChannelFactory}.
+ *
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
*
diff --git a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java
index 13d814213d..5d2bcdbd5f 100644
--- a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java
+++ b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java
@@ -22,23 +22,95 @@
*/
package org.jboss.netty.channel.socket;
+import java.net.Socket;
+
import org.jboss.netty.channel.ChannelConfig;
+/**
+ * A {@link ChannelConfig} for a {@link SocketChannel}.
+ *
+ * @author The Netty Project (netty-dev@lists.jboss.org)
+ * @author Trustin Lee (tlee@redhat.com)
+ *
+ * @version $Rev$, $Date$
+ *
+ */
public interface SocketChannelConfig extends ChannelConfig {
+
+ /**
+ * Gets the {@code SO_TCPNODELAY} option.
+ */
boolean isTcpNoDelay();
+
+ /**
+ * Sets the {@code SO_TCPNODELAY} option.
+ */
void setTcpNoDelay(boolean tcpNoDelay);
+
+ /**
+ * Gets the {@code SO_LINGER} option.
+ */
int getSoLinger();
+
+ /**
+ * Sets the {@code SO_LINGER} option.
+ */
void setSoLinger(int soLinger);
+
+ /**
+ * Gets the {@code SO_SNDBUF} option.
+ */
int getSendBufferSize();
+
+ /**
+ * Sets the {@code SO_SNDBUF} option.
+ */
void setSendBufferSize(int sendBufferSize);
+
+ /**
+ * Gets the {@code SO_RCVBUF} option.
+ */
int getReceiveBufferSize();
+
+ /**
+ * Gets the {@code SO_RCVBUF} option.
+ */
void setReceiveBufferSize(int receiveBufferSize);
+
+ /**
+ * Gets the {@code SO_KEEPALIVE} option.
+ */
boolean isKeepAlive();
+
+ /**
+ * Sets the {@code SO_KEEPALIVE} option.
+ */
void setKeepAlive(boolean keepAlive);
+
+ /**
+ * Gets the traffic class.
+ */
int getTrafficClass();
+
+ /**
+ * Sets the traffic class as specified in {@link Socket#setTrafficClass(int)}.
+ */
void setTrafficClass(int trafficClass);
+
+ /**
+ * Gets the {@code SO_REUSEADDR} option.
+ */
boolean isReuseAddress();
+
+ /**
+ * Sets the {@code SO_REUSEADDR} option.
+ */
void setReuseAddress(boolean reuseAddress);
+
+ /**
+ * Sets the performance preferences as specified in
+ * {@link Socket#setPerformancePreferences(int, int, int)}.
+ */
void setPerformancePreferences(
int connectionTime, int latency, int bandwidth);
}