Advertisement

C# Networking resources?!

Started by March 26, 2017 11:44 PM
2 comments, last by Socterean 7 years, 8 months ago
Hello everyone!

I started to learn game developing and programming as a hobby with no prior education in the field of programming.

So I picked up some books and eBooks and started to learn the programming part in general, but now I have stumbled uppon a problem.

I have tried to find some books on the C# networking topic and I can't seem to find any...

I am using Unity but my interest is to see how to create dedicated servers and to learn about the general infrastructure for creating and running them, so if anyone can point me in the right direction I would kindly appreciate.

P.S: I am not interested in the MMO topic, but rather in little servers that can hold 10 players...basically a place to start learning more about how networking is done using .net framework and what tools should I look for

Thanks in advance!

I'm pretty sure there's a port of ENet for C#, which supports UDP and has some nice examples in the official website. Books are nice, but you will learn a lot, too, by going straight to coding. Books will superficially cover the tricky aspects of networking, because they depend very much on the design of the game. Especially problems with latency.

Advertisement

For a quick working example you may look at this blog post https://scatteredcode.wordpress.com/2013/04/29/creating-a-single-threaded-multi-user-tcp-server-in-net/

Setting up a client/server or UDP communication environment is relatively simple in C#. Using the IAsyncResult interface and socket.BeginAccept/ socket.BeginReceive to handle incomming stuff async makes your server handle any ammount of connections/users asynchrounous.

I myself have build something in general arround .Net 2.0 with the same technics and it worked as well as today. Be carefully because an incomming BeginReceive is stated in another thread so you need to synchronise when doing command related UI stuff

Thank you both for the info. And I understand your points of view, those are some invaluable resources that will definetlly help me. If anyone can still provide some sort of resource that also contains the principles of networking so I can understand theoretically what is going on, or what is supposed to go on and how before I jump into code it would be so helpfull for me.

Basically I need to understand the principles of how servers are made and run before starting to code, so I can understand what I need to do and why

This topic is closed to new replies.

Advertisement