当前位置: 首页>>代码示例>>Java>>正文


Java ServerSocketFactory类代码示例

本文整理汇总了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();
	} 
    }
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:26,代码来源:GssServer.java

示例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);
	}
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:8,代码来源:GSSService.java

示例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;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:34,代码来源:GridFTPServerFacade.java

示例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;

}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:36,代码来源:FTPServerFacade.java

示例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();
}
 
开发者ID:fast-data-transfer,项目名称:fdt,代码行数:7,代码来源:GSIBaseServer.java


注:本文中的org.globus.net.ServerSocketFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。