Simplest way to listen to another server?
I have server A (Windows, C#.NET), which needs to send an alert/signal to server B (Linux, Java, Apache) everytime a certain process is done. I need to do this using a method call from .NET. What would be the easiest way to do this? I am thinking of setting up a web server on server B on some port which would listen to requests from server A. But how should I go about this? I am new to Java and ha开发者_StackOverflow社区ve no experience with writing java web services, and I need to get this up quick, that is why I want to do this as easy as possible.
Look into Sockets. Instead of setting up an entire webserver, you can just have server B listen on a port and have server A allow connections, and send data on that same port. There are millions of examples online for sockets, and Java and .NET both have them (most languages do).
http://ondotnet.com/pub/a/dotnet/2002/10/21/sockets.htm
http://download.oracle.com/javase/tutorial/networking/sockets/
You might be interested in Thrift, which is designed for cross-language services. It only takes a few minutes to setup a simple server/client application in any of the supported languages. It supports Java and C#.
Thrift is used heavily by Facebook, so it is mature enough for production use.
Since you say apache: Use WebClient
精彩评论