Question

Are there any Mono (C#) compatible networking / socket libraries out there?

Preferably something that is:

  • Multi Threaded
  • Event Driven
  • Capable of multiple connections
  • Handles client and server pieces
  • Runs on Mono and MS .NET runtimes
  • Very simple
  • Free (And usable in commercial software)

It would also be really great if it was:

  • .NET Compact Framework (Windows Mobile) compatible
  • MonoTouch (iPhone) compatible

Edit:

To clarify more, what I meant by my "one level above TCP/IP" comment was that I want something that is basically a self contained server / client. I don't want to have to deal with writing the threading code, handling each connection, etc. For example, I would love for the code to look like this:

Server s = new Server(8080);
s.NewConnection += new ConnectionEventHandler(NewConnection);
s.DataRecieved += new DataEventHandler(NewData);
s.Start();

void NewConnection(object sender, EventArgs e)
{
   s.Send((Connection)sender, "Hello World!"); //(Connection)sender is the connection instance so the server knows which to send the response to
}

void NewData(object sender, EventArgs e)
{
   s.Send((Connection)sender, e.Data); //Echo back
}

Not the cleanest code, but I think it gives the basic idea.

Was it helpful?

Solution

Something like this now exists, checkout networkComms.net. Does all of the things you require and is also 100% compatible with mono.

Disclaimer: I am one of the developers for this commercial library.

OTHER TIPS

No, there is nothing out of the box that does what you want.

TcpClient/TcpListenr are already one level above Socket class. If you really want something that is even simpler, it is a very easy task to wrap TcpListener() and make it expose the event handler entry points that you want.

You should check out RemotingLite. I use it with my Mono applications. It was developed to aid in the networking aspect of the Distributed Computing Library MPAPI. MPAPI had a goal of being 100% compatible with Mono.

I am not clear as to what exactly you expect from a class that is "one level above TcpClient and TcpListener"?

TcpClient/TcpListener are the basic building blocks you should use for development. I am not sure if they are supported in Mono as well, but if they are, then it should be all you need.

.Net CompactFramework also supports these, although I am not sure about Mono Touch.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top