How to declare IP for server run?

normen, i think problem is in situation, when UDP is real blocked on network infrastructure master firewall.



network admin, give me restriction to use only TCP(UDP is blocked). Becouse all TCP traffic go through proxy load-balancing.





its not my imagination, that it dont work :wink:





edit:



yes, there are no UDP, same in my code… then why it dont work? :>

You posted two NPE’s and one “port out of range”. This is definitely not because of blocked UDP ports. Again, check if you try to send unreliable messages.

1 Like

normen, its easy:


  1. UDP unblocked: work


  2. UDP blocked: dont work - ICMP Port Unreachable


  3. “server = new DefaultServer(“castway”, 1, reliable, null );” - exception



    “port out of range” was when i tried not “null” but udp port as -1

    just dont look at it.

Then post the error, not some errors that are due to you misusing the libraries -.-

1 Like

ok all situations:



Situation 1:

Envoirement: Blocked UDP on network infrastructure. Server Created with tcp and udp

Description:

2012-01-27 14:33:44 com.jme3.network.base.DefaultClient handleError
SEVERE: Termining connection due to unhandled error
com.jme3.network.kernel.ConnectorException: Error reading from connection to:[hidden ;) ]
at com.jme3.network.kernel.udp.UdpConnector.read(UdpConnector.java:129)
at com.jme3.network.base.ConnectorAdapter.run(ConnectorAdapter.java:159)
Caused by: java.net.PortUnreachableException: ICMP Port Unreachable
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.PlainDatagramSocketImpl.receive(Unknown Source)
at java.net.DatagramSocket.receive(Unknown Source)
at com.jme3.network.kernel.udp.UdpConnector.read(UdpConnector.java:120)
… 1 more



Situation 2:
Envoirement: UnBlocked UDP on network infrastructure. Server Created with tcp and udp
Description:
WORK, but we need finally UDP blocked


Situation 3:
Envoirement: Blocked and unblocked UDP(both situations) on network infrastructure
“server = new DefaultServer(“castway”, 1, reliable, null );” - Server only with TCP, and UDP as null

Description:
2012-01-27 15:07:21 com.jme3.network.kernel.tcp.SelectorKernel$SelectorThread connect
INFO: Hosting TCP connection:/[hidden :) ]:33001.
Exception in thread “main” java.lang.NullPointerException
at com.jme3.network.base.DefaultServer.start(DefaultServer.java:159)
at cwserver.DatabaseServer.initServer(DatabaseServer.java:219)
at cwserver.DatabaseServer.main(DatabaseServer.java:243)
2012-01-27 15:07:21 com.jme3.network.kernel.tcp.SelectorKernel$SelectorThread run
INFO: Kernel started for connection:/[hidden :) ]:33001.


from line DefaultServer.java:157
[java] // Initialize the kernels
for( KernelAdapter ka : channels ) {
ka.initialize();
}[/java]
so seems like "ka" is null -> exception




[java] reliableAdapter = new KernelAdapter( this, reliable, dispatcher, true );
if( fast != null ) {
fastAdapter = new KernelAdapter( this, fast, dispatcher, false );
}

channels.add( reliableAdapter );
channels.add( fastAdapter );
[/java]

it seem like it add null...

There you go, just make a proper error report… Fixed in svn. And btw, the initialization did not fail, sending to the network neither. Reading from the network failed.

1 Like

if i good found:



Google Code Archive - Long-term storage for Google Code Project Hosting.



i will try it later :slight_smile:



and when it is usually able to update it via SDK?(i have nightly)



i tried to make override Class and i changed constructor to this(like in revision):



[java] if( reliable == null )

throw new IllegalArgumentException( "Default server reqiures a reliable kernel instance." );



this.gameName = gameName;

this.version = version;



reliableAdapter = new KernelAdapter( this, reliable, dispatcher, true );

channels.add( reliableAdapter );

if( fast != null ) {

fastAdapter = new KernelAdapter( this, fast, dispatcher, false );

channels.add( fastAdapter );

}

[/java]



with create:



[java]

InetSocketAddress inetAddress = new InetSocketAddress(IP, tcpPort);

SelectorKernel reliable = new SelectorKernel(inetAddress);

server = new DefaultServerCw("castway", 1, reliable, null );

[/java]



but then it give other(same like Situation 1 before ) exception while connection:



client exception:



2012-01-27 16:34:47 com.jme3.network.base.DefaultClient handleError
SEVERE: Termining connection due to unhandled error
com.jme3.network.kernel.ConnectorException: Error reading from connection to:[loadbalancing server ;)]:8080
at com.jme3.network.kernel.udp.UdpConnector.read(UdpConnector.java:129)
at com.jme3.network.base.ConnectorAdapter.run(ConnectorAdapter.java:159)
Caused by: java.net.PortUnreachableException: ICMP Port Unreachable
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.PlainDatagramSocketImpl.receive(Unknown Source)
at java.net.DatagramSocket.receive(Unknown Source)
at com.jme3.network.kernel.udp.UdpConnector.read(UdpConnector.java:120)
... 1 more


server message(when it received message from Client) (in both situations: blocked and unblocked UDP - of course):

2012-01-27 16:34:47 com.jme3.network.kernel.tcp.SelectorKernel$SelectorThread cancel
INFO: Closing channel endpoint:NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/[ip]:33001 remote=/[ip]:51370]].
2012-01-27 16:34:47 cwserver.DefaultServerCw registerClient
INFO: Client registered:{0}.
2012-01-27 16:34:47 cwserver.DefaultServerCw connectionClosed
INFO: Client closed:{0}.


so server.getConnections() are empty after connect

For a client connecting to a server with no UDP it also has to specify -1 for the UDP port. That should have also worked on the createServer() call. It was the recently added NPE that was the real problem, I think.



I changed these classes to be able to support multiple TCP channels and I must have broken the “no UDP” case. Normen has fixed the server.



If the connectToServer() with a -1 UDP port also fails with an NPE then there may be a bug there. But if you turn UDP on for a client then it will try to send a UDP packet to the server… which may trigger the error you are getting.

1 Like

so how should i configure Client at the moment? (to not use UDP and work)



same null Connector for UDP like null SelectorKernel for UDP in server?

Do you also need to specify a specific IP on the client or can you get away with Network.connectToServer() with a -1 for UDP?

1 Like

you was fastest(i wanted edit post), yes i tested -1 for a client and it work perfect :slight_smile: closed connection after some time, but it is propably my fail



so only server had a bug with “-1”