Java 类com.badlogic.gdx.Net.Protocol 实例源码

项目:libgdxcn    文件:NetJavaServerSocketImpl.java   
public NetJavaServerSocketImpl (Protocol protocol, int port, ServerSocketHints hints) {
    this.protocol = protocol;

    // create the server socket
    try {
        // initialize
        server = new java.net.ServerSocket();
        if (hints != null) {
            server.setPerformancePreferences(hints.performancePrefConnectionTime, hints.performancePrefLatency,
                hints.performancePrefBandwidth);
            server.setReuseAddress(hints.reuseAddress);
            server.setSoTimeout(hints.acceptTimeout);
            server.setReceiveBufferSize(hints.receiveBufferSize);
        }

        // and bind the server...
        InetSocketAddress address = new InetSocketAddress(port);
        if (hints != null) {
            server.bind(address, hints.backlog);
        } else {
            server.bind(address);
        }
    } catch (Exception e) {
        throw new GdxRuntimeException("Cannot create a server socket at port " + port + ".", e);
    }
}
项目:libgdxcn    文件:NetJavaSocketImpl.java   
public NetJavaSocketImpl (Protocol protocol, String host, int port, SocketHints hints) {
    try {
        // create the socket
        socket = new java.net.Socket();
        applyHints(hints); // better to call BEFORE socket is connected!

        // and connect...
        InetSocketAddress address = new InetSocketAddress(host, port);
        if (hints != null) {
            socket.connect(address, hints.connectTimeout);
        } else {
            socket.connect(address);
        }
    } catch (Exception e) {
        throw new GdxRuntimeException("Error making a socket connection to " + host + ":" + port, e);
    }
}
项目:Cubes_2    文件:ClientNetworking.java   
public static PingResult ping(ClientNetworkingParameter clientNP) {
    Log.debug("Pinging Host:" + clientNP.host + " Port:" + clientNP.port);
    Socket socket;
    try {
        socket = Gdx.net.newClientSocket(Protocol.TCP, clientNP.host, clientNP.port, socketHints);
        return ClientConnectionInitializer.ping(socket);
    } catch (Exception e) {
        PingResult pingResult = new PingResult();
        pingResult.failure = true;
        pingResult.exception = e;
        return pingResult;
    }
}
项目:Cubes    文件:ClientNetworking.java   
public static PingResult ping(ClientNetworkingParameter clientNetworkingParameter) {
  Log.debug("Pinging Host:" + clientNetworkingParameter.host + " Port:" + clientNetworkingParameter.port);
  Socket socket;
  try {
    socket = Gdx.net.newClientSocket(Protocol.TCP, clientNetworkingParameter.host, clientNetworkingParameter.port, socketHints);
    return ClientConnectionInitializer.ping(socket);
  } catch (Exception e) {
    PingResult pingResult = new PingResult();
    pingResult.failure = true;
    pingResult.exception = e;
    return pingResult;
  }
}
项目:Cubes_2    文件:ServerSocketMonitor.java   
public ServerSocketMonitor(int port, ServerNetworking serverNetworking) {
    this.port = port;
    this.serverNetworking = serverNetworking;
    serverSocket = Gdx.net.newServerSocket(Protocol.TCP, port, Networking.serverSocketHints);
    running = new AtomicBoolean(true);
}
项目:Cubes    文件:ServerSocketMonitor.java   
public ServerSocketMonitor(int port, ServerNetworking serverNetworking) {
  this.port = port;
  this.serverNetworking = serverNetworking;
  serverSocket = Gdx.net.newServerSocket(Protocol.TCP, port, Networking.serverSocketHints);
  running = new AtomicBoolean(true);
}
项目:gdx-backend-jglfw    文件:JglfwNet.java   
@Override
public ServerSocket newServerSocket (Protocol protocol, String hostname, int port, ServerSocketHints hints) {
    return new NetJavaServerSocketImpl(protocol, hostname, port, hints);
}
项目:gdx-backend-jglfw    文件:JglfwNet.java   
public ServerSocket newServerSocket (Protocol protocol, int port, ServerSocketHints hints) {
    return new NetJavaServerSocketImpl(protocol, port, hints);
}
项目:gdx-backend-jglfw    文件:JglfwNet.java   
public Socket newClientSocket (Protocol protocol, String host, int port, SocketHints hints) {
    return new NetJavaSocketImpl(protocol, host, port, hints);
}
项目:libgdxcn    文件:ServerSocket.java   
/** @return the Protocol used by this socket */
public Protocol getProtocol ();
项目:libgdxcn    文件:NetJavaServerSocketImpl.java   
@Override
public Protocol getProtocol () {
    return protocol;
}
项目:mini2Dx    文件:IOSMini2DxNet.java   
@Override
public ServerSocket newServerSocket (Protocol protocol, String hostname, int port, ServerSocketHints hints) {
    return new NetJavaServerSocketImpl(protocol, hostname, port, hints);
}
项目:mini2Dx    文件:IOSMini2DxNet.java   
@Override
public ServerSocket newServerSocket (Protocol protocol, int port, ServerSocketHints hints) {
    return new NetJavaServerSocketImpl(protocol, port, hints);
}
项目:mini2Dx    文件:IOSMini2DxNet.java   
@Override
public Socket newClientSocket (Protocol protocol, String host, int port, SocketHints hints) {
    return new NetJavaSocketImpl(protocol, host, port, hints);
}