I want to create a websocket server and I've found a great article here. However C# will output an exe file.

I'd like to have it run on a linux box. What I want to do is to connect to the server, and when something happens on the filesystem to retrieve a message from the server (using the FileSystemWatcher on Windows or the iNotify daemon on linux) and the program will run the corresponding code.

So, how can such daemon for linux (in C#) or any other way to achieve this?

  • I know this doesn't answer your question, hence the comment. For C# on Linux, take a look at mono. – Ben Burns May 22 '12 at 13:51
  • @BenBurns I am aware of Mono, but I don't know if it would work in a server environment (so no gui, while in C# it would be a console application). – Devator May 22 '12 at 13:53
  • 1
    Mono works fine for CLI apps. Depending on your distro however, you may need a custom build which doesn't require X11, as some package managers might be dumb and try to pull down X when you install mono. – Ben Burns May 22 '12 at 13:57

I'm not sure if you're really requiring C# on linux (which isn't really wise and forces you to use mono).

There are other great ways to manage websockets on a linux server. For example node.js, java(not personally tested) or my favorite : go.

| improve this answer | |
  • Hmm thanks, can it also check if the filesystem has been changed? I don't think it can and I might be forced to use C# or any other "real" language. – Devator May 22 '12 at 14:35
  • I'm not familiar with inotify in Go but this may be what you need : golang.org/pkg/syscall/#InotifyAddWatch. By the way I don't see in what C# is more "real" than Go (or another language). – Denys Séguret May 22 '12 at 14:54
  • true, C# is just another language - and a 2nd class one on Linux. Linux's API for getting filesystem changes is called inotify ibm.com/developerworks/linux/library/l-ubuntu-inotify. – gbjbaanb May 22 '12 at 15:07
  • 1
    @Devator, use Mono (it's free port .NET (and C# so) on Linux) – Sergey May 23 '12 at 6:03

I develop a WebSocket component named WebSocketListener that supports Mono. Take a look on this guide about how to make it work with Mono.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.