Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
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
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
@BenBurns Thanks, it seems to work perfectly. –  Devator May 23 '12 at 9:38

2 Answers 2

up vote 1 down vote accepted

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.

share|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). –  dystroy 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
@Devator, use Mono (it's free port .NET (and C# so) on Linux) –  Sergey May 23 '12 at 6:03
@Sergey Thanks, it seems to work perfectly. –  Devator May 23 '12 at 9:37

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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