Best choice for Long-polling / Comet in Java or C#? - c#

Which native server is best, in your opinion, to implement long-polling / Comet? The first target application is chat, but there will be other implementations - we basically need push-to-client capabilities.
I'm limiting the answers to C# or Java because these two technologies are dominant at my workplace. The requirements are as usual: performance, ease of deployment/programming, customization, ...

IIS + WebSync is a very straight-forward, scalable and extensible solution for server push. There is a free Community edition I highly recommend checking out.

Both Java and .NET platforms have enough capabilities to handle your needs. If you choose Java : You may start with DWR otherwise, on the .net side PokeIn library should be the choice.

I just saw this blogpost from Scott Hanselman yesterday. It looks very promising.
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx
It features an opensource product called SignalR which is available through nuget.
You can find an example chat application in the sources # github
https://github.com/SignalR/SignalR

I don't think there's a significant difference in this regard.

Try netty-socketio project. It's a Java framework with long-pooling and websocket support using famous Socket.IO protocol.

I know that special attention was paid to Comet support in the Grizzly engine used by Glassfish. It wasn't treated as an afterthought.

Related

What's the best way to call c# code in c code on linux

I am doing a project and have a C# library but I need to call it in C code on Linux. What's the most efficient way to do this? Performance is the first consideration.
Of course, I can make a C# service and use TCP to talk. But I wonder if it's the best way...
Thank you!
You can also use CoreRT to create native libraries from C# code and call them from C. You can find an example here
Edit: CoreRT has moved to runtimelab feature NativeAOT. Updated link.
I think the most standard solution is to have your C# service export a "web services" remote API, which the C code can then access via the standard Linux web services packages. In effect these support a form of RPC, but with web pages encoding the request and also the reply. The advantage of using web services is generality; your solution will port to any platform and will work from any language, not just C.
Another way to go is to use one of the new open-source packages from Google, Facebook, Twitter, etc. A bunch of the cloud vendors are open-sourcing their RPC infrastructures because many customers pose your exact question and need these solutions. Those will definitely be faster and more powerful in other ways too: they include powerful performance visualization tools and debuggers of various kinds. Microsoft has a remote method invocation technology too. So these are an option, perhaps less general but definitely faster. So you then have to ask how important speed is, for this particular path...
The bottom line then is that there are maybe five packages you could use. No idea which is winning or best!

Cache server for .NET(Example Memcached)

I am looking for cache server for .NET. What can you suggest? As i know memcached has provider for .net. Is it good enough to use for .net in production?
AppFabric is another popular solution from Microsoft.
If you're willing to run your cache server in Linux, you could use Redis, and use the BookSleeve library from .NET, this is what StackOverflow uses
http://code.google.com/p/booksleeve/
Scale Out State Server is an excellent solution. It's not free, but for large-scale applications, it's one of the best options that we found.
NCache is another option, though I have no experience with it.
For enterprise scale (and budget) there's Oracle's Coherence. It works extremely well, though it's extremely pricey.
Here's another SO question with some information that may or may not be helpful:
Caching Solutions
Memached is plenty good for production, probably best using the enyim provider.
Couchbase provide a good web ui and easy memcached install on windows. Free if on a single server. It's great to be able to monitor your cache instance.
They have paid for solutions but and their own server.
AppFabric as mentioned is another obvious candidate but not a mature as memcached. AppFabric is an application server and can also provide distributed caching like membase
See the post Top caching libraries for .NET for several options, including both free and commercial. The choice will vary based on your actual need.
though there are numbers of third party caching solutions are available for .NET but if we narrow done the research based upon Google and word of mouth, it might be
1) Memcached
2) Appfabric
3) NCache
firs two are free/open source software so they have some limitations in it, while on the other hand NCache has a lot to offer as compared to others, but you have to buy it. but it has also a free version available called as NCache Express. below are two important links in this regard,
Video on NCache Vs AppFabric
Blog on NCache Vs AppFabric

What is Silverlight? (In one sentence, in an interview)

Consider you are in an interview for a .NET/C# job, and are asked:
What is Silverlight, in one sentence?
EDIT: OK, some took it the funny way:-) I have accepted one of the more serious approaches though. However, thanks to all posters.
Microsoft Flash.
It's a framework for building interactive applications for the web, desktop, and mobile devices using .NET technologies.
This is my own try:
It's .NET in a browser.
Microsoft found the the way Java Applets should have worked.
Silverlight is a cross-platform approach for usable user interfaces within a browser.
It's Microsoft's answer to Adobe Flash, but its more powerful as it can utilise the rest of the .NET framework.
I would say something like ...
Microsofts aproach at embedding a lightweight version of the .Net framework in to a portable package that can be deployed on many platforms, this is often compared to flash of java as they also take the same aproach, essentially the idea is to allow the .Net platform to reach other areas where a full install would not be required / suitable.
... or ...
Its a cut down version of WPF designed to run on any platform with a lightweight deploy.
Simple answer is that it is a compact edition of WPF.
Silverlight is microsofts way of making flashy applications. Ops, was that a pun?
Vector-based animations and RIA based ond XAML and .NET.
Microsoft Silverlight is yet an another fad into web2.0 casket.
Silver light is a new cross-browser, cross-platform implementation of the .NET Framework for building and delivering the next generation of media experiences and Rich Interactive Applications(RIA) for the web. It runs in all popular browsers.It is combination of different technologies into a single development platform that allows you to select tools and the programming language you want to use. Silver light integrates seamlessly with your existing JavaScript and ASP.NET AJAX code to complement functionality which you have already created.

TLS/SSL in .net

Is there any (hopefully free/open source) code available that does native TLS/SSL communication? I do not speak about the HTTPListener/Client and WebRequest classes. I'd like to do raw TLS communication in my C# code.
Thanks in advance,
Max
Here's an article on codeproject, it also includes code for using OpenSSL.
Do you mind if I ask what you're trying to achieve? Just curious really; there's lots of high-level wrapper classes for this kind of thing so you don't normally need to work at this level (not that there's anything wrong with that :-)
http://www.mentalis.org/soft/projects/ssocket/ - been using this in a commercial product for the last 5 years in .net 1.0, 2.0 and now 3.0. Very reliable, simple to use and stable.
Built-in (as at time of writing) SslStream object makes this easy - see https://www.medo64.com/2014/09/client-authenticated-tls-in-c/

Interaction between Java and C#

Is it possible to write a user interface in Java for an application written in C#?
I am working on a user interface of a project that is written in C#, but I have no experience with C# and I am an avid Java user. Is it possible to build the user interface in Java using Java's Swing and AWT libraries that operates an application primarily written in C#.
If this sounds like a really stupid question, I apologize in advance.
You might be able to leverage some of the interoperability features that are integrated into Mono 2.0
http://www.mono-project.com/Main_Page
JNBridge is another possible interoperability solution:
http://www.jnbridge.com/
However, a more optimal approach might be to expose your .NET code as Services - and then access them from the Java client (or through a light-weight ESB).
Of course, time, budget, resources are constraints you'll have to consider.
In addition to http://www.jnbridge.com (proprietary)
you can try http://www.janetdev.org, - open source implementation of a Java 5 SE JDK environment for the .NET platform. Currently it supports .Net 3.5 only (not Mono).
We did this recently and went the route of using a low level socket connection, but pushing xml through it. C# was the server side, and we used the Microsoft 'xsd' tool to generate the XSD schema for the objects and then used JAXB on the java side to generate java code to parse and hold the same objects.
As Barry mentions most of the work/problems was around the socket connection - but that depends on how comfortable you are with that.
Also, for a solution that cross-compiles your java to run in the CLR: http://www.ikvm.net/
I am author of jni4net, open source interprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.

Categories

Resources