Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [KryoNet failure, client connects, than disconnects]  (Read 596 times)
0 Members and 1 Guest are viewing this topic.
Offline GabrielBailey74

JGO Knight


Medals: 8
Projects: 6


<3 Java


« Posted 2012-08-28 06:59:57 »

This problem started today, I programmed a Java file, added a KryoNet server/client into it, when their both (client/server) ran in the same file, it seems to work..

Now im trying to separate them into 2 files (Client.java, Server.java) and it doesn't want to work Sad
As soon as the client Connects, I've tried sending a Packet/Class instantly, thinking that that's what was causing the instant client disconnection, and it isn't.

Servers Console:
1  
2  
3  
4  
5  
[Server]: New ServerLogger processed.
[Server]: Class registered.
[Server]: GServer started: 54555 / 54777.
[Server]: A Client has connected.
[Server]: A Client has been Disconnected.


Client Console: (Where it disconnects..)
1  
2  
3  
4  
[Client]: New ClientLogger processed.
[Client]: Class registered.
[Client]: GClient started: 1000000, 127.0.0.1, 54555, 54777.
Press any key to continue . . .


Client.java
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
   public static void main(String[] args) {
      logger = new ClientLogger("Client");
      client = new GClient(TIME_OUT, HOST_ADDRESS, TCP_PORT, UDP_PORT);
      client.register(client.Packet.class);
      client.addListener(clientListener = new client.ClientListener());
      try {
         client.start();
      } catch (IOException e) {
         getLogger().log("Unable to connect to: "+HOST_ADDRESS+" / "+TCP_PORT+"!");
         System.exit(0);
      }
   }


Server.java
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
   public static void main(String[] args) {
      logger = new ServerLogger("Server");
      server = new GServer(TCP_PORT, UDP_PORT);
      server.register(server.Packet.class);
      server.addListener(serverListener = new server.ServerListener());
      try {
         server.start();
      } catch (IOException e) {
         getLogger().log("Unable to connect to: "+TCP_PORT+" / "+UDP_PORT+"!");
         System.exit(0);
      }
   }


I do have classes dedicated to handling the Listeners (both client/server) if you're wondering.
(Maybe I've been programming too much today)
Really hope someone can help.

Offline marcuiulian13

Senior Member


Medals: 3



« Reply #1 - Posted 2012-08-28 21:46:26 »

Probably you send too much to the client / to the server. Make sure that the data you send isn't too large and you don't send it in a small delay.

Check out my current project: http://cube3dev.blogspot.com/
Please comment/review/suggest.
Offline GabrielBailey74

JGO Knight


Medals: 8
Projects: 6


<3 Java


« Reply #2 - Posted 2012-08-28 23:49:25 »

I'm not even sending anything, and even when i do send/recieve in my working example, i can send 10MB++ in under a few seconds.
That's not the problem here.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (76 views)
2013-05-17 21:29:12

alaslipknot (87 views)
2013-05-16 21:24:48

gouessej (117 views)
2013-05-16 00:53:38

gouessej (112 views)
2013-05-16 00:17:58

theagentd (122 views)
2013-05-15 15:01:13

theagentd (111 views)
2013-05-15 15:00:54

StreetDoggy (156 views)
2013-05-14 15:56:26

kutucuk (178 views)
2013-05-12 17:10:36

kutucuk (177 views)
2013-05-12 15:36:09

UnluckyDevil (185 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.08 seconds with 21 queries.