I would like to know whether there is a way to write a comet server in C#. i have a C# code that generates data periodicall开发者_开发知识库y, and I want to push these data to a java app. So would like to convert my C# code to a comet server. Also would like to know whether there is any comet server implemented that lets us connect the C# application and java application to it, so that the C# application can pass information to the java app, through the comet server. data push frequency would be high, but the size of an individual message is very small: a string value.
Let's get this straight.
I'm assuming this is a followup to this question: communication between Java and C#
This is app to app communication on the same machine with only strings as the payload, right?
Why COMET? Why not just send null terminated strings directly via a socket connection? Implementing a Comet server is far from trivial, and is only used in situations where more direct communication is disallowed (i.e. server to browser push). Comet for app to app communication on the same machine would be very complex for a solution that is easily solved with sockets.
It can definitely be done, but writing a comet server in c# is a fairly complex task. We've built one (WebSync), and it took quite some effort. If you're just doing a research project, you can use the OnDemand version, which is hosted, and has 10 free users. Right now, the Server version isn't free, but is pretty cheap...
For what it's worth, if you do decide to roll your own, you're going to be looking at the IHttpAsyncHandler, and you'll need to do some thread management to deal with the default threadpool limits in IIS.
You may need some sample source code for your implementation? PokeIn reverse ajax library was an open source project and the source codes for earlier versions still downloadable at codeplex site.
Obviously, the latest version of PokeIn library is one of the most great libraries for .Net framework and you may use their free community edition.
精彩评论