Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The client (desktop app) pulls data...but I want the server (web app) to push data

I have a client-server application - wherein the server is essentially an ASP .NET web application and the distributed clients are desktop applications.

The clients need to receive some data from the server - when there is new data for the client. Right now, the way this is done is - the client keeps querying a web service every x minutes (say 2 minutes) and keeps checking if there's new data for the client.

Ideally, the way it should work is that the desktop app should receive updates as and when they are available, it need not pull from the server; instead the server should be able to push to the client.

How do I go about doing this - given the architecture of the solution - a web application needs to push data to desktop applications (clients) in the same network (a LAN)?

like image 528
Sameet Avatar asked May 25 '09 17:05

Sameet


People also ask

How send data from server to client without request?

You can use web-sockets which are two way communication between client and server that remain open and allow the server to send without request from the client.

How request is sent from client to server?

As a quick summary, the HTTP/1.1 protocol works as follows: The client (usually a browser) opens a connection to the server and sends a request. The server processes the request, generates a response, and closes the connection if it finds a Connection: Close header.

What should the client use to contact the server?

To connect to the server, the client places the port number and the IP address of the server into a sockaddr_in structure like the bind() call. If the client does not know the server IP address, but it does know the server host name, the gethostbyname() call is called to translate the host name into its IP address.

What is client and server in Web technology?

In general, all of the machines on the Internet can be categorized as two types: servers and clients. Those machines that provide services (like Web servers or FTP servers) to other machines are servers. And the machines that are used to connect to those services are clients.


1 Answers

What you're describing is "server push", which these days is often called "COMET". Using those keywords in a web search should turn up a lot of useful information.

The most common technique for this is called a "hanging GET". The client sends a GET request to a specific URL, and the server accepts the connection but delays sending a response until it has data to send. When the client receives the response it sends another GET so it's ready for another message.

like image 183
Jens Alfke Avatar answered Sep 18 '22 10:09

Jens Alfke