Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (581)
Games in Android Showcase (162)
games submitted by our members
Games in WIP (632)
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  
  Moving from a String based approach?  (Read 2664 times)
0 Members and 1 Guest are viewing this topic.
Offline CTucker1327
« Posted 2014-07-28 16:20:06 »

I want to make my networking better. I'm working with the Netty API and I've written a Client/Server application that breaks apart a String that's been sent over the network and figures things out. An example of my Login packet would look like this.


Where [1] is the packet Id, and then the user/pass (all data, really) is split by the character '@'

7, player.getSession())
                .writeByte(recoveryChange, ValueType.C)
                .writeShort(messages, ValueType.A)
                .writeByte(memberWarning ? 1 : 0)
                .writeInt(lastLoginIP, ByteOrder.INVERSE_MIDDLE)

Here is an example of what I'm looking for. Something that creates a packet like such. I've been looking and looking, and I have a github for a server project that uses this type of networking, but I don't understand it.  I'm looking more so on tutorials/documentation for this.
Offline Riven
« League of Dukes »

« JGO Overlord »

Medals: 967
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #1 - Posted 2014-07-28 16:47:11 »

DataInputStream, DataOutputStream.

Better: KryoNet

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline CTucker1327
« Reply #2 - Posted 2014-07-28 20:47:05 »

KyroNet is better than Netty?

Could you please provide more information? I can't find any benchmark comparisons, etc.

The reason I chose Netty was due to the fact I use a C# based client.
I was reading the KyroNet didn't support C# Clients, as it used a special network layer? Not sure, never got into it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline jmaasing

Junior Newbie

« Reply #3 - Posted 2014-07-29 07:14:32 »

So you are looking for something that can serialize java objects to a compact binary representation that is also serializable to from C#? I would guess that you either hand-roll the protocol: i.e. on both the java and the C# side know that to read an int you need to read 4 bytes (or whatever). DataInput/OuputStream is reasonably compact and have a well defined byte layout of primitives so that's a good tip from Riven.

Other options would be to use google protocol buffers and try to find a C# translation for that.
Kryo is a very good serialization framework that is used by KryoNet but I'm not sure how easy that would be to read in C#.
Offline Mike

« JGO Spiffy Duke »

Medals: 144
Projects: 1
Exp: 6 years

Java guru wannabe

« Reply #4 - Posted 2014-07-29 14:07:50 »

I'm busy with doing exactly this, and I find Kryonet awesome so far. I recommend it without a doubt Smiley


My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline alesky

Junior Devvie

Medals: 3
Exp: 15 years


« Reply #5 - Posted 2014-07-29 15:27:57 »

if your implementation is a serve centric
where each client will keep a connection whit the server, you can chose a standard interchange protocol

for example you can use CORBA or SOAP

this protocols keep you far for the real technical issues connection, serialization, deserialziation
what you have to do in your code is just create the data that will be transfer

there are several implementation for both the protocols in JAVA or C#, and in case you can integate easily also whit other languages if u need in future


Offline Riven
« League of Dukes »

« JGO Overlord »

Medals: 967
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #6 - Posted 2014-07-29 15:42:48 »

I would pick plain-text over CORBA/SOAP any day.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline kevglass

« JGO Spiffy Duke »

Medals: 263
Projects: 25
Exp: 18 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #7 - Posted 2014-07-29 15:44:58 »

CORBA/SOAP/RMI/RPC would be very poor choices here. Generic object serialization is going to bite you very quickly. Kyro is definitely a good way to go here, if not just encode your pure data encoding isn't too bad - wrap it up a bit and you'd probably be fine.



Offline ClaasJG

Senior Devvie

Medals: 17

« Reply #8 - Posted 2014-07-30 08:46:32 »

Kryo is a very good serialization framework that is used by KryoNet but I'm not sure how easy that would be to read in C#.

I would use kryonet. I like its api but not Kryo. In a pure java enviroment it is awesome but hard to work with in other languages.

But kryonet supports custom serialization ( I would recomment to look at bson and


My english has to be tweaked. Please show me my mistakes.
Offline delt0r

JGO Knight

Medals: 33
Exp: 18 years

Computers can do that?

« Reply #9 - Posted 2014-07-30 11:49:03 »

Whatever you do, DON'T use CORBA. You would be better off stabbing yourself in the face with a blunt axe.

Yes i have used it extensively in the telecoms i once worked at. God i hope they moved on by now.

Seriously what is wrong with plain text. It is much much easier to debug since network inspection tools work out of the box. Performance is almost never needed and even if it is in the future i would always have a plain text fallback/debug mode.

I have no special talents. I am only passionately curious.--Albert Einstein
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

MrMapcom (11 views)
2015-05-23 20:26:16

MrMapcom (18 views)
2015-05-23 20:23:34

Waterwolf (29 views)
2015-05-20 15:01:45

chrislo27 (35 views)
2015-05-20 03:42:21

BurntPizza (70 views)
2015-05-10 15:53:18

FrozenShade (55 views)
2015-05-07 09:11:21

TheLopais (218 views)
2015-05-06 13:36:48

TheLopais (202 views)
2015-05-06 13:35:14

TheLopais (206 views)
2015-05-06 13:33:39

TheLopais (226 views)
2015-05-06 13:32:48
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00 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‑
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!