38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package org.kne.cloud.network;
|
|
|
|
import java.io.IOException;
|
|
import java.net.InetAddress;
|
|
import java.net.InetSocketAddress;
|
|
import java.nio.channels.ServerSocketChannel;
|
|
|
|
public class DefaultServerSocketChannelFactory extends ServerSocketChannelFactory {
|
|
|
|
@Override
|
|
public ServerSocketChannel createServerSocketChannel() throws IOException {
|
|
return ServerSocketChannel.open();
|
|
}
|
|
|
|
@Override
|
|
public ServerSocketChannel createServerSocketChannel(int port) throws IOException {
|
|
ServerSocketChannel ssc=ServerSocketChannel.open();
|
|
ssc.bind(new InetSocketAddress(port));
|
|
return ssc;
|
|
}
|
|
|
|
@Override
|
|
public ServerSocketChannel createServerSocketChannel(int port, int backlog) throws IOException {
|
|
ServerSocketChannel ssc=ServerSocketChannel.open();
|
|
ssc.bind(new InetSocketAddress(port),backlog);
|
|
return ssc;
|
|
}
|
|
|
|
@Override
|
|
public ServerSocketChannel createServerSocketChannel(int port, int backlog, InetAddress ifAddress)
|
|
throws IOException {
|
|
ServerSocketChannel ssc=ServerSocketChannel.open();
|
|
ssc.bind(new InetSocketAddress(ifAddress,port),backlog);
|
|
return ssc;
|
|
}
|
|
|
|
}
|