Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Networking & Multiplayer / Re: Kryonet - Client continues to send but stops receiving on: 2013-05-05 21:40:16
Ah, that seems to have fixed it!  I bumped the Client send rate back to 60 messages per second and it's working as expected.

Thanks for your help.
2  Game Development / Networking & Multiplayer / Re: Kryonet - Client continues to send but stops receiving on: 2013-05-05 12:11:43
Okay, it I have mitigated the problem by sending client position updates to the server at a slower rate.  I raised INPUT_SEND_RATE from 1000/60 to 1000/10 and my game is working as expected.
3  Game Development / Networking & Multiplayer / Re: Kryonet - Client continues to send but stops receiving on: 2013-05-05 11:49:18
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
      
//Kryonet Client.java


// Line 221
if (select == 0) {
         // NIO freaks and returns immediately with 0 sometimes, so try to keep from hogging the CPU.
        long elapsedTime = System.currentTimeMillis() - startTime;
         try {
            if (elapsedTime < 25) Thread.sleep(25 - elapsedTime);
         } catch (InterruptedException ex) {
         }
      } else {
         Set<SelectionKey> keys = selector.selectedKeys();
         synchronized (keys) {
            for (Iterator<SelectionKey> iter = keys.iterator(); iter.hasNext();) {
               SelectionKey selectionKey = iter.next();
               iter.remove();

// ...



I started GameClient in a debugging session and I set the debugger to break if the selector had any keys (i.e., if the program reached "Set<SelectionKey> keys = selector.selectedKeys();").  The program would only break once every five seconds or so (or it wouldn't break at all before timing out).  In the client log, it was seen that all of the GameStateUpdate packets delivered from the server would then be processed at once.  So it looks like the client is receiving the messages from the server, but they can't be delivered to Kryonet for some reason, so they all clump up until they are all delivered at once.

I also removed the synchronized blocks in my code and it didn't seem to affect anything.

I am running the client and the server on the same computer.  The client is connecting to the server at 127.0.0.1.
4  Game Development / Networking & Multiplayer / Kryonet - Client continues to send but stops receiving on: 2013-05-05 07:59:47
Hello, I am trying to make a simple multiplayer game using Slick and Kryonet.

I am having problems with the client.  It will connect to the server and read a few messages, but after that, it stops receiving messages and it times out.  It doesn't stop sending messages to the server, however.  The server seems okay, as it is sending and receiving messages as I expect that it would. After 12s, the client times out.  The debugger also indicates that, after the first few packets received, the client listener received function is not being called at all.

I've tried running the client in debug mode and pausing it about a second after it connects.  The messages that ordinarily would not have been read now show up in the message queue.  Similarly, if I prematurely quit the client (not running in debug mode), the client log shows that the client has read the messages.

I'm confused!  Any help would be appreciated.

Code:
http://pastebin.java-gaming.org/349099d665d

Server Log: http://pastebin.com/TpPBv0dh
Client Log: http://pastebin.com/FZM9DB7q
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (11 views)
2014-04-15 18:08:23

BurntPizza (10 views)
2014-04-15 03:46:01

UprightPath (23 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (107 views)
2014-04-08 23:06:04

tom_mai78101 (207 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!