user1240679
user1240679

Reputation: 6979

Transferring data from server to multiple clients sequentially

I've an application in which I want to include the networking module for it to be able to send the data to multiple clients (different machines on same WiFi network). This application generates image data for each client every hour and has to send this data to 10 different clients which are on the same WiFi network. When the data transfer to all the clients finishes, all the clients have to simultaneously display the data on the screens.

I've not developed any networking modules earlier and have minimal experience in this. My initial search just showed that I probably should be transferring the data to all the clients first somehow and then broadcast a signal for the clients for them to show the data simultaneously. I wanted to get an idea of the approach that should be followed for something like this - how would the server send the image data to all the clients?
I think in my case, it's more of time-critical than reliable data transfer needed, so I'd be inclined to use UDP to get faster transfers. I understand that I can send the data to client in a queuing fashion but is there a mechanism of knowing which clients on the network are waiting for the data? Is there a client-register-with-server kind of thing through which I can keep a note of all the clients where the data has to be sent? Is this client-register thing possible in UDP?

Through my application, I'll be able to create a UDP Server Socket on a specific port - but how will multiple clients notify sequentially (every client can't notify together obv.) to my server about their availability on the network and how do I then keep a note of their host addresses/ports?

Upvotes: 0

Views: 538

Answers (2)

Vikram Bhat
Vikram Bhat

Reputation: 6246

I advocate use of TCP over UDP if the data needs to sent reliably otherwise UDP would be sufficient . In your case it seems that image data must be reliably sent so use TCP. As you are dealing with multiple clients it would be good to be responsive so you should divide the data in chunks and then send it over network using round robin or Shortest first scheduling of a queue of client requests. At client side collect the data and render it as it comes rather then waiting for whole data. To achieve dynamic rendering use PNG or JPEG file formats. Use multithreading if needed.

Upvotes: 0

Aunn Raza
Aunn Raza

Reputation: 468

just another approach: create number of threads equal to number of users and load it from thread pool, for each client, one thread will be allocated and will make a tcp connection to send the image and have a tcp listener on each client that will listen for any data retrieval from server.

Upvotes: 1

Related Questions