本文整理汇总了Java中org.globus.net.ServerSocketFactory类的典型用法代码示例。如果您正苦于以下问题:Java ServerSocketFactory类的具体用法?Java ServerSocketFactory怎么用?Java ServerSocketFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerSocketFactory类属于org.globus.net包,在下文中一共展示了ServerSocketFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.globus.net.ServerSocketFactory; //导入依赖的package包/类
public static void main(String [] args) {
String usage = "Usage: java GssServer [options] [port]";
GetOpts opts = new GetOpts(usage, helpMsg);
int pos = opts.parse(args);
int port = 0;
if (pos < args.length) {
port = Integer.parseInt(args[pos]);
}
ServerSocketFactory factory = ServerSocketFactory.getDefault();
try {
ServerSocket server = factory.createServerSocket(port);
System.out.println("Server running at: " + server.getLocalPort());
while(true) {
Client c = new Client(server.accept(), opts);
c.start();
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: GSSService
import org.globus.net.ServerSocketFactory; //导入依赖的package包/类
public GSSService(boolean secure, int port, InetAddress bindTo) throws IOException {
super(secure, port);
if (bindTo != null) {
this._server.close();
this._server = ServerSocketFactory.getDefault().createServerSocket(port, 50, bindTo);
}
}
示例3: setStripedPassive
import org.globus.net.ServerSocketFactory; //导入依赖的package包/类
public HostPortList setStripedPassive(int port, int queue)
throws IOException {
// remove existing sockets, if any
socketPool.flush();
if (serverSocket == null) {
ServerSocketFactory factory =
ServerSocketFactory.getDefault();
serverSocket = factory.createServerSocket(port, queue);
}
gSession.serverMode = GridFTPSession.SERVER_EPAS;
gSession.serverAddressList = new HostPortList();
String address = Util.getLocalHostAddress();
int localPort = serverSocket.getLocalPort();
HostPort hp = null;
if (remoteControlChannel.isIPv6()) {
String version = HostPort6.getIPAddressVersion(address);
hp = new HostPort6(version, address, localPort);
} else {
hp = new HostPort(address, localPort);
}
gSession.serverAddressList.add(hp);
logger.debug("started single striped passive server at port " +
((HostPort) gSession.serverAddressList.get(0)).getPort());
return gSession.serverAddressList;
}
示例4: setPassive
import org.globus.net.ServerSocketFactory; //导入依赖的package包/类
/**
Start the local server
@param port required server port; can be set to ANY_PORT
@param queue max size of queue of awaiting new connection
requests
@return the server address
**/
public HostPort setPassive(int port, int queue)
throws IOException{
if (serverSocket == null) {
ServerSocketFactory factory =
ServerSocketFactory.getDefault();
serverSocket = factory.createServerSocket(port, queue);
}
session.serverMode = Session.SERVER_PASSIVE;
String address = Util.getLocalHostAddress();
int localPort = serverSocket.getLocalPort();
if (remoteControlChannel.isIPv6()) {
String version = HostPort6.getIPAddressVersion(address);
session.serverAddress =
new HostPort6(version, address, localPort);
} else {
session.serverAddress =
new HostPort(address, localPort);
}
logger.debug("started passive server at port " +
session.serverAddress.getPort());
return session.serverAddress;
}
示例5: GSIBaseServer
import org.globus.net.ServerSocketFactory; //导入依赖的package包/类
public GSIBaseServer(final GSSCredential cred, final int port) throws IOException {
this.credentials = cred;
this._server = ServerSocketFactory.getDefault().createServerSocket(port);
this.secure = true;
initialize();
}