Sign in to follow this  
PanicRave

c++ port of lidgren?

Recommended Posts

Quickie: Has anyone been working on a c/c++ port of lidgren OR is there any established method of communicating with a lidgren based server using c? I know lidgren uses a custom protocal.

I started writing some network services using lidgren because a) I love it and b) its quite portable but I had completely failed to look into scenarios like wanting to connect to those services from a game I wrote in c :/

Now I'm weighing up the complexity of writing a c client library or rewriting my services using basic sockets! :/

Share this post


Link to post
Share on other sites
If a wrapper is suitable then it would be ideal as id only have one library to keep up to date! But I was concerned about the portability of wrapping managed code - for example if me or someone else is writing a native android app in c++ would they be able to use my api? I've done unmanaged to managed wrappers before but it seems weird the other way around! Lol

Share this post


Link to post
Share on other sites

Your wrapper wouldn't be portable unless you can be assured of running lidgren on the platform you are porting to.  You should probably plan this in advance, keeping the wrapper as simple as possible and expecting to have to deal with things like mono as well as the official Microsoft .NET framework.

 

I think this is possible, it just needs careful planning before you start writing any code. I haven't googled it, but i am betting someone has beaten you to the punch and already implemented such a wrapper with lidgren being such a popular library...

Share this post


Link to post
Share on other sites
Mono and .NET are both open source at this point, and available on all platforms that matter. Thus, it should be possible to create a wrapper that goes C++ -> C# (which is, admittedly, the "wrong" direction compared to most other uses :-) You would have to include the Mono runtime with your wrapper/C-level code.

An alternative is to use a C level library, such as RakNet, instead of Lidgren, and write a C# -> C wrapper to import RakNet into your C# code. This would probably be more straightforward, and more palatable to developers used to doing "only C" and not including large support libraries.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this