[ENet-discuss] Can i use other UDP server farmework like boost::asio or libuv and enet as client ?

Len Holgate len.holgate at jetbyte.com
Wed Aug 17 04:56:12 PDT 2016


ENet will give you a semi-reliable, fast, udp network layer that has been tested and that works. It will give you a solid base of C code that you can use on the client side on lots of OS’s.

 

As for the rest, it depends…

 

I tend to always try and get a single thread of functionality all the way through (end to end) as soon as possible. So I’d probably start with a simple ENet client server system using the ENet source code with no changes. Make sure you have a clean interface to your game logic so that you can throw away the network layer and replace it on the server at a later point. Then get something that works and learn how to load test it to the point that either it is good for what you want or it fails. You want a repeatable load test that doesn’t require people and that can be automated – you’ll learn a lot getting this working ;)

 

If this first version fails to achieve the scalability that you need then begin to think about replacing it, or scaling back your ideas… If you replace it on the server then it’s certainly possible but it’s quite a lot of work.

 

Threads can be useful, if you know how to work with them. They can also be very dangerous, if you don’t.

 

Personally I always like to “measure performance from day 0” - http://www.serverframework.com/asynchronousevents/2010/10/how-to-support-10000-or-more-concurrent-tcp-connections---part-2---perf-tests-from-day-0.html  It tends to stop me doing stupid things and then doing things that compound the stupid things until I’ve hosed all possible performance…

 

Len

www.serverframework.com <http://www.serverframework.com> 

 

 

From: ENet-discuss [mailto:enet-discuss-bounces at cubik.org] On Behalf Of Meir Yanovich
Sent: 17 August 2016 12:18
To: Discussion of the ENet library <enet-discuss at cubik.org>
Subject: Re: [ENet-discuss] Can i use other UDP server farmework like boost::asio or libuv and enet as client ?

 

Thanks Len 
Im not network programmer but done here and there networking . 
i have allot of years experience in c/c++ . the problem is that i don't sure if the Enet alone will be enough for my needs which are :
1. asyce server 

2. game logic all in server game loop done in c or c++ 

3. performance as good as it can get . 
4. can i use threads ? 2 or 3 for DB updates and such ?

this is small game in scope but planning burst os allot of connections to play . 

 

On Wed, Aug 17, 2016 at 1:39 PM, Len Holgate <len.holgate at jetbyte.com <mailto:len.holgate at jetbyte.com> > wrote:

You need to determine that it’s not good enough for yourself. It wasn’t appropriate for what we wanted to do. Partly due to perceived performance but more due to threading requirements, scalability and integration issues.

 

One issue that we came across was delaying our sends so that we built up enough data in a datagram. The async nature of our code worked against us a bit here and we needed timers so that we could accumulate and then send and a) not need to accumulate a complete datagram of enet commands (which would create lag) and b) not send every command separately (which would flood the network and be inefficient). The standard ENet code does this nicely based on the polling nature but it was something we needed to deal with and it took us a while to get it right. 

 

Dispatch of inbound data was quite complex as was our retransmission logic, mainly due to the desire to reduce memory copies where possible.

 

Wireshark is your friend ;)

 

I wrote all of the C++ code myself, with the client’s team doing the managed layer, so it’s certainly something that one person can do. It will depend on your familiarity with what you’re doing – I’ve been doing network code for a long time and was writing the ENet protocol using our own framework of which I have intimate knowledge. If you’re learning boost::asio or whatever AND ENet then it may be more complex.

 

Len

www.serverframework.com <http://www.serverframework.com> 

 

From: ENet-discuss [mailto:enet-discuss-bounces at cubik.org <mailto:enet-discuss-bounces at cubik.org> ] On Behalf Of Meir Yanovich
Sent: 17 August 2016 10:59


To: Discussion of the ENet library <enet-discuss at cubik.org <mailto:enet-discuss at cubik.org> >
Subject: Re: [ENet-discuss] Can i use other UDP server farmework like boost::asio or libuv and enet as client ?

 

Hey Len thanks very much answering 

Few more questions if i may 

Ok so i understand that the Enet Sever as server  not good good enough . 
What if i take something like boost::asio or libuv and reverse engineer the protocol of ENet what should i look in to from your experience ?
Do you think one men could do it ? or it is team effort ?

Thanks 

 

On Wed, Aug 17, 2016 at 12:03 PM, Len Holgate <len.holgate at jetbyte.com <mailto:len.holgate at jetbyte.com> > wrote:

Our server is fully asynchronous in C++ using overlapped I/O (IOCP) and only a few threads for socket I/O (4, generally). It easily supports > 4000 concurrent and active connections with the game logic written in managed code (C#) which we host using the CLR hosting API.

 

We didn’t spend much time with the existing ENet server as it just didn’t fit with what we wanted. We just used it as a way to reverse engineer the protocol requirements.

 

Len

www.serverframework.com <http://www.serverframework.com> 

 

 

From: ENet-discuss [mailto:enet-discuss-bounces at cubik.org <mailto:enet-discuss-bounces at cubik.org> ] On Behalf Of Meir Yanovich
Sent: 17 August 2016 09:54


To: Discussion of the ENet library <enet-discuss at cubik.org <mailto:enet-discuss at cubik.org> >
Subject: Re: [ENet-discuss] Can i use other UDP server farmework like boost::asio or libuv and enet as client ?

 

Len Holgate 
Thanks! 
can you please give more info ? 
is the server thread based or event based ? 
what is the limits of integrating or extending the enet server ?

 

On Wed, Aug 17, 2016 at 11:38 AM, Len Holgate <len.holgate at jetbyte.com <mailto:len.holgate at jetbyte.com> > wrote:

We built a Windows, IOCP based C++ server using the ENet protocol for a client and it’s been working well for around 9 years now. We have had to tweak things a little to get the scalability that they wanted and write it all from scratch but it’s not that complex once you understand how the protocol works.

 

Len

www.serverframework.com <http://www.serverframework.com> 

 

 

From: ENet-discuss [mailto:enet-discuss-bounces at cubik.org <mailto:enet-discuss-bounces at cubik.org> ] On Behalf Of Ruud van Gaal
Sent: 17 August 2016 09:29
To: Discussion of the ENet library <enet-discuss at cubik.org <mailto:enet-discuss at cubik.org> >
Subject: Re: [ENet-discuss] Can i use other UDP server farmework like boost::asio or libuv and enet as client ?

 

ENet uses a complicated protocol to do its communication, so to create a server in another framework would effectively mean reverse engineering ENet and typing your own code. It's not like its built on an existing standard protocol.

So my guess would be to just use ENet where you want to use ENet. ;-)

 

Ruud

 

On Wed, Aug 17, 2016 at 9:32 AM, Meir Yanovich <meiry242 at gmail.com <mailto:meiry242 at gmail.com> > wrote:

Hello all
As i understand from the documents it is best to use enet as the server as it know how to 
Handle the peers and the UDP ordring and such ... 
my question is can i implement the server in other c/c++ framework ? 
is it recommended ? is it easily possible? 
or the ENet server is strong enough to act as MMO server ? 
Thanks !


_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org <mailto:ENet-discuss at cubik.org> 
http://lists.cubik.org/mailman/listinfo/enet-discuss

 


_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org <mailto:ENet-discuss at cubik.org> 
http://lists.cubik.org/mailman/listinfo/enet-discuss

 


_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org <mailto:ENet-discuss at cubik.org> 
http://lists.cubik.org/mailman/listinfo/enet-discuss

 


_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org <mailto:ENet-discuss at cubik.org> 
http://lists.cubik.org/mailman/listinfo/enet-discuss

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20160817/3b0c2a7e/attachment-0001.html>


More information about the ENet-discuss mailing list