diff --git a/engine/src/networking/com/jme3/network/Network.java b/engine/src/networking/com/jme3/network/Network.java index 5d946da9b..83bffd0c9 100644 --- a/engine/src/networking/com/jme3/network/Network.java +++ b/engine/src/networking/com/jme3/network/Network.java @@ -115,56 +115,41 @@ public class Network /** * Creates a Client that communicates with the specified host and port - * using both reliable and fast transports. The localUdpPort specifies the - * local port to use for listening for incoming 'fast' UDP messages from the - * server. This port is different than the host port in case the client - * and server are run on the same machine. + * using both reliable and fast transports. */ - public static Client connectToServer( String host, int hostPort, int localUdpPort ) throws IOException + public static Client connectToServer( String host, int hostPort ) throws IOException { - return connectToServer( DEFAULT_GAME_NAME, DEFAULT_VERSION, host, hostPort, hostPort, localUdpPort ); + return connectToServer( DEFAULT_GAME_NAME, DEFAULT_VERSION, host, hostPort, hostPort ); } /** - * Creates a Client that communicates with the specified host and port - * using both reliable and fast transports. The localUdpPort specifies the - * local port to use for listening for incoming 'fast' UDP messages from the - * server. This port is different than the host port in case the client - * and server are run on the same machine. + * Creates a Client that communicates with the specified host and separate TCP and UDP ports + * using both reliable and fast transports. */ - public static Client connectToServer( String host, int hostPort, int remoteUdpPort, - int localUdpPort ) throws IOException + public static Client connectToServer( String host, int hostPort, int remoteUdpPort ) throws IOException { - return connectToServer( DEFAULT_GAME_NAME, DEFAULT_VERSION, host, hostPort, remoteUdpPort, - localUdpPort ); + return connectToServer( DEFAULT_GAME_NAME, DEFAULT_VERSION, host, hostPort, remoteUdpPort ); } /** * Creates a Client that communicates with the specified host and port - * using both reliable and fast transports. The localUdpPort specifies the - * local port to use for listening for incoming 'fast' UDP messages from the - * server. This port is different than the host port in case the client - * and server are run on the same machine. + * using both reliable and fast transports. */ public static Client connectToServer( String gameName, int version, - String host, int hostPort, int localUdpPort ) throws IOException + String host, int hostPort ) throws IOException { - return connectToServer( gameName, version, host, hostPort, hostPort, localUdpPort ); + return connectToServer( gameName, version, host, hostPort, hostPort ); } /** - * Creates a Client that communicates with the specified host and port - * using both reliable and fast transports. The localUdpPort specifies the - * local port to use for listening for incoming 'fast' UDP messages from the - * server. This port is different than the host port in case the client - * and server are run on the same machine. + * Creates a Client that communicates with the specified host and and separate TCP and UDP ports + * using both reliable and fast transports. */ public static Client connectToServer( String gameName, int version, - String host, int hostPort, int remoteUdpPort, - int localUdpPort ) throws IOException + String host, int hostPort, int remoteUdpPort ) throws IOException { InetAddress remoteAddress = InetAddress.getByName(host); - UdpConnector fast = new UdpConnector( localUdpPort, remoteAddress, remoteUdpPort ); + UdpConnector fast = new UdpConnector( remoteAddress, remoteUdpPort ); SocketConnector reliable = new SocketConnector( remoteAddress, hostPort ); return new DefaultClient( gameName, version, reliable, fast ); @@ -178,16 +163,14 @@ public class Network super( gameName, version ); } - public void connectToServer( String host, int port, int remoteUdpPort, - int localUdpPort ) throws IOException + public void connectToServer( String host, int port, int remoteUdpPort ) throws IOException { - connectToServer( InetAddress.getByName(host), port, remoteUdpPort, localUdpPort ); + connectToServer( InetAddress.getByName(host), port, remoteUdpPort ); } - public void connectToServer( InetAddress address, int port, int remoteUdpPort, - int localUdpPort ) throws IOException + public void connectToServer( InetAddress address, int port, int remoteUdpPort ) throws IOException { - UdpConnector fast = new UdpConnector( localUdpPort, address, remoteUdpPort ); + UdpConnector fast = new UdpConnector( address, remoteUdpPort ); SocketConnector reliable = new SocketConnector( address, port ); setConnectors( reliable, fast ); diff --git a/engine/src/networking/com/jme3/network/NetworkClient.java b/engine/src/networking/com/jme3/network/NetworkClient.java index 4c0e364a8..7cc5ec059 100644 --- a/engine/src/networking/com/jme3/network/NetworkClient.java +++ b/engine/src/networking/com/jme3/network/NetworkClient.java @@ -46,10 +46,8 @@ import java.net.InetAddress; */ public interface NetworkClient extends Client { - public void connectToServer( String host, int port, int remoteUdpPort, - int localUdpPort ) throws IOException; + public void connectToServer( String host, int port, int remoteUdpPort ) throws IOException; - public void connectToServer( InetAddress address, int port, int remoteUdpPort, - int localUdpPort ) throws IOException; + public void connectToServer( InetAddress address, int port, int remoteUdpPort ) throws IOException; } diff --git a/engine/src/networking/com/jme3/network/kernel/udp/UdpConnector.java b/engine/src/networking/com/jme3/network/kernel/udp/UdpConnector.java index b31cd942a..951f83a02 100644 --- a/engine/src/networking/com/jme3/network/kernel/udp/UdpConnector.java +++ b/engine/src/networking/com/jme3/network/kernel/udp/UdpConnector.java @@ -64,9 +64,9 @@ public class UdpConnector implements Connector * Creates a new UDP connection that send datagrams to the * specified address and port. */ - public UdpConnector( int localPort, InetAddress remote, int remotePort ) throws IOException + public UdpConnector( InetAddress remote, int remotePort ) throws IOException { - InetSocketAddress localSocketAddress = new InetSocketAddress(localPort); + InetSocketAddress localSocketAddress = new InetSocketAddress(0); this.sock = new DatagramSocket( localSocketAddress ); remoteAddress = new InetSocketAddress( remote, remotePort );