2 way comms between multiple clients & web app

0
0

Hi,

I’ve seen how a http ashx handler can receive continuous data from remote clients, however I’d like to explore a polling method, where the web app polls each client in turn for data.

Can anyone provide any pointers?

Clients will be .net desktop apps.

How do you go about making the web app aware of each client in the first place?

I’m guessing there needs to be some kind of initial pairing, rather like Bluetooth. Once paired, the web app “knows” the client(s) & can communicate as desired.

What type of property do you use as the identification?

Ideally the web app should remember the list of clients so connecting in the future will be quicker/easier.

Thank you

Darren

  • Darren
    Hi, Maybe the chat example could be adapted for this? If the JOIN(), SEND_MESSAGE() and LEAVE() methods can be replicated in a separate desktop app., then this would probably be suitable. So, the question is, can the JOIN(), SEND_MESSAGE() and LEAVE() methods can be replicated in a separate desktop app.? If so, I haven’t a clue how to do this so would you be so kind as to provide a simple VB desktop example? Thank you
  • You must to post comments
0
0

The clients will have to register themselves. A simple http request (ashx handler would do). They can send their name or anything else as an argument. The server can keep track of the clients by name or id and should also save their IPs (use Application.UserHostAddress to read the IP of the client that is registering).

Then the server can send requests back to the IP address of the clients.

If the client is rebooted or if the client uses a dynamic IP that may change, the the client should simply periodically refresh its IP again through a simple http request.

  • Luca (ITG)
    Using the WebRequest or WebClient class. It simply needs to make a plain URL request and read the response.
  • Darren
    Ahhh, OK. I had a hunch that was the case but wasn’t sure. I’m trying to find other, similar scenarios on the web but I can’t. It almost seems I’m doing something unique. Maybe I’m not looking in the right places. I’m also struggling with picking the right comms. method. It now seems I can use a webclient at both ends, but why would I choose this over, say, a TCP channel. I could also use Modbus TCP, for example. It “feels” like I should use webclient because it keeps everything “web”, but this is not necessarily the correct or best way. I don’t know. In any case, I’m pretty certain a polling method (once all clients have made an initial connection/registration) is the best method of data transfer because it has the obvious benefit of the web app. being in control of the system, rather than multiple clients randomly sending continuous data and hoping the web app. captures it all. I imagine all comms. will need to async.
  • Darren
    Luca, Sorry, I’m unsure how to read the client ip address using Application.UserHostAddress. I will need to register the client within the handler, I assume. “Application” is a type. Can’t I get the client ip address from the request (context) in the handler?
  • Darren
    I need to add that I will want to get the client IP (and computer name, if possible) via both IIS and stand-alone hosting.
  • Darren
    Perhaps the client needs to send it’s IP in the initial registration request?
Showing 1 result
Your Answer

Please first to submit.