Simplest, multiplatform way to do network communication?

For issues with communication ports, protocols, etc.
Post Reply
xlucas
Posts: 334
Joined: May 09, 2014 21:19
Location: Argentina

Simplest, multiplatform way to do network communication?

Post by xlucas »

Hi, guys! This is perhaps the area of programming of which I know the least. I'm trying to find the best way to do network communication in my very simple game. I'm mostly trying to learn about communications and the game is just the "excuse". What I would like is this:

* Multiplatform: It's important for me that I can easily compile the program for both Linux and Windows, at least, with few to no changes.
* Portability: If possible, I would like my program not to require a third party library to be installed by the user to run. That is, the final, compiled executable should already do everything. If a library is used, it should either be statically linked into the program, or even better, be guaranteed to be found with the OS as it comes installed.
* Simplicity: I'm not looking for a very powerful library to do lots of tricks. I just want to send an receive packets or streams and think as little as possible about protocols. I want to handle that as if I just had a null-modem cable or similar.

Basing on these ideal wishes (because they are not imperative "requests", but things I hope I can get)... what do you suggest me to use? Where can I get it? Where can I learn to use it? I appreciate your help very much, folks :)

Oh, I forgot to say... If I can do LAN only, that's already fabulous, but if I can also connect over the internet, even better. Please let me know which is the case. Thank you!
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Simplest, multiplatform way to do network communication?

Post by grindstone »

Hi,

maybe try TSNE. It's probably a bit oversized for your purposes, but it will surely match your needs.

Greetings
grindstone

PS: If you need help with translation, let me know.
Kot
Posts: 336
Joined: Dec 28, 2006 10:34

Re: Simplest, multiplatform way to do network communication?

Post by Kot »

grindstone wrote:maybe try TSNE.
Or not exactly TSNE, but TSNE Game Pack. It contains logging in, sending data to other clients etc.
xlucas
Posts: 334
Joined: May 09, 2014 21:19
Location: Argentina

Re: Simplest, multiplatform way to do network communication?

Post by xlucas »

Mmm.... I've been reading and yeah, I think this would be probably too big. Maybe the best would be to try to do it the standard way, without a third party library. Is it too complicated? For something like this, should I use TCP, UDP or something else? What would be the standard way to do this in GNU/Linux and in Windows without using third-party libraries? If it's not too complicated, maybe I can just use an #if-#else-#endif and the code will be much simpler.

Can you guys link me to some sample code to do this on each of these two OSs? Or give me an example here? Thank you so much!
Post Reply