Server keeps closing my client

Hi all, I have a pretty standard networked game. Recently, I upped the amount of messages I’m sending from each client, and it’s giving me an error “IllegalStateException: Client is not started”. On the server, I see the following messages:

[java]Nov 10, 2013 2:30:03 PM com.jme3.network.kernel.tcp.SelectorKernel$SelectorThread cancel
INFO: Closing channel endpoint:NioEndpoint[5, java.nio.channels.SocketChannel[connected local=/127.0.0.1:4142 remote=/127.0.0.1:58857]].
Nov 10, 2013 2:30:03 PM com.jme3.network.base.DefaultServer connectionClosed
INFO: Client closed:Connection[ id=4, reliable=NioEndpoint[5, java.nio.channels.SocketChannel[closed]], fast=UdpEndpoint[5, /127.0.0.1:59571] ].
Nov 10, 2013 2:30:03 PM com.jme3.network.kernel.udp.UdpKernel closeEndpoint
INFO: Closing endpoint:UdpEndpoint[5, /127.0.0.1:59571].[/java]

I can send a few messages fine, but when I send 2 in a row of a particular type, it closes the connection. I debugged the engine code, and it takes me through the selector kernel until it ultimately calles “wakeup”. I’m not sure what the difference between the messages, or what “wakeup” does or means, so I figured I would just throw it out there. If the messages I posted are not enough, I can show you some code, but it’s pretty standard.

I will need more information. If you haven’t added an error listener on the client then please do that.

There were some errors that happened on the server or the client prior to the connection getting closed but if you don’t have an error listener registered then you may miss them.

Other helpful information would be the messages your are sending and how you are handling them on the server.

Cool thanks for the heads up on the error listener, I’ll set that up now and let you know what I find.

I do have a somewhat related question. I think part of the problem (after looking at my error outputs) has to with my client not waiting for a response before sending the next message. I have a system set up that queues up actions related to messages I have sent, but does jmonkey have any built-in synchronization capabilities?

@devinp52 said: I do have a somewhat related question. I think part of the problem (after looking at my error outputs) has to with my client not waiting for a response before sending the next message. I have a system set up that queues up actions related to messages I have sent, but does jmonkey have any built-in synchronization capabilities?

SpiderMonkey is already queuing messages. send() always returns immediately unless the connection isn’t fully setup yet in which case it blocks.

…I can’t comment further without seeing the errors.