views:

384

answers:

6

I would like to have a client-server application written in .NET which would do following:

  • server is running Linux
  • on the server there is SQL database (mySQL) containing document URLs

What we want: - server side would regularly crawl all URLs and create a full text index for them - client side would be able to perform a query into this index using GUI

The client application is written in .NET using C#. Besides of searching in documents it will be able to do a lot of other things which are not described here and which are done client-side very well.

We would like to use C# for the server side as well, but we have no experience in this area. How are things like this usually done?


Clarifying question now based on some answers:

The thing which is most unclear to me is how client-server communication is usually handled. Is client and server usually using sockets, caring about details like IP addresses, ports or NAT traversal? Or are there some common frameworks and patters, which would make this transparent, and make client-server messaging or procedure calling easy? Any examples or good starting points for this? Are there some common techniques how to handle the fact a single server is required to server multiple clients at the same time?

+1  A: 

If you can't code it yourself, it is usually done by hiring someone who can

truppo
Yes, this is an option, but just for sake of discussion consider I would like to learn this. Where should I start? What is common architecture of such applications? What languages (and runtime environments if you think .NET is bad choice) are usually used for them?
Suma
+1  A: 

To use c# on Linux you will need to use Mono. This is an open source implementation of the CLR specification.

Next you need to decide on how to communicate between server and client, from the lowest level of just opening a TCP/IP socket and sending bits up and down, to .Net remoting, to WCF, to exposing webservices on the server. I do not know how compleat WCF implementation is on mono, also I think you may have issue with binary remoting between mono and MS .Net .

I would suggest RPC style WebServices offer a very good solution. WebServices also have the advantage of alowing clients from other platforms to connect easily.

EDIT In response to the clarification of the question. I would suggest using mono/ASP.NET/WebServices on the server, if you wish to use c# on both server and client.

One assumption I have made is that you can do a client pull model, where every message is initiated by the client. Using another approach could allow the server to push events to the client. Given the client has the ability to pole the server regularly I don't consider this much of a draw back but it may be depending on the type of application you are developing.

Mono allow execution of c# (compiled to IL) on a Linux box. Mono ASP.NET allows you to use the standard ASP.NET and integrate into Apache see http://www.mono-project.com/ASP.NET and finally WebServices allow you to communicate robustly in a strongly typed manner between you client and your server.

Using this approach negates most of the issues raised in your clarification and makes them someone else's problem.
Sockets/SSL - is taken care of by standard .Net runtime on the client and Apache on the server.
IPAddress/ports/NAT traversal - Is all taken care of. DNS look up will get the servers IP. Open socket will allow the server to respond through any firewall and NAT setup.
Multiple Clients - Apache is built to handle multiple clients processing at the same time as is ASP.NET, so you should not encounter any problems there.

David Waters
following up on a comment on the question. I too would advise using a more matuer and supported environment on the server, like Java. C# and Java can talk easily between each other using either Raw sockets/http/webserverices.
David Waters
A: 

have a look at Grasshopper: "With Grasshopper, you can use your favorite development environment from Microsoft® to deploy applications on Java-enabled platforms such as Linux"

Or see here

The ideea is to convert your app to Java and then run it on Tomcat or JBoss.

lmsasu
A: 

Another approach: use the Mod_AspDotNet module for Apache, as described here.

lmsasu
I am afraid ASP.NET is not what I am for, if I undestand correctly what ASP.NET. I would like to have a real client side standalone application, not a web based UI.
Suma
A: 

This Basic Client/Server Chat Application in C# looks like a kind of example which might be a starting point for me. Relevant .NET classes are TcpClient and TcpListener

Suma
+1  A: 

As many have already mentioned there are a number of thing that you have mentioned which are going to cause you pain. I'm not going to go into those, instead I will answer your original question about communication.

The current popular choice in this kind of communication is web services. These allow you to make remote calls using the HTTP protocol, and encoding the requests and responses in XML. While this method has its critics I have found it incredibly simple to get up and running, and works fine for nearly all applications.

The .NET framework has built in support for web services which can definitely be called by your client. A brief look at the mono website indicates that it has support for web services also, so writing your server in C# and running it under mono should be fine. Googling for "C# Web Service Tutorial" shows many sites which have information about how to get started, here is a random pick from those results:

http://www.codeguru.com/Csharp/Csharp/cs_webservices/tutorials/article.php/c5477

Jack Ryan