1

i'm trying to connect two machines. Azure Cloud service (A) with Linux machine (B) that doesn't belong to Windows Azure. What i`am trying to do is to make an open connection between A and B. So A could know that B is alive. I can't ping B from A directly because B will be in internal network. B doesn't have public IP that i could ping. In other words B will connect to internet thru router. I need to send some commands to B from web via A. Thats why i need to keep open connection between A and B. Any solutions, ideas or articles that i could read to achieve this ?

Here is diagram of infrastructure for more details enter image description here

Daniil T.
  • 149
  • 6
  • What's the NAT configuration on both sides look like? – Shane Madden Nov 20 '14 at 18:28
  • What do you mean? Communication server has public static IP. Wireless Access Point has dynamic IP. So i need B machines to initialize connection to ComServ. – Daniil T. Nov 20 '14 at 18:37
  • So then why can't the node behind the router connect to the node with the static IP? – Shane Madden Nov 20 '14 at 18:39
  • It can. By i'am looking for any source how can do it. I'am not really sure how it suppose to be done. I think i need to use Azure Service Bus, but i didn't find any resource, article or tutorial. All information/articles that i found are old. Azure Changed since then. – Daniil T. Nov 20 '14 at 18:42
  • I mean i know how to init connection to Azure machines from outside azure cloud, but i don't know how to keep it open. I don`t know what i should looking for over the google – Daniil T. Nov 20 '14 at 18:44
  • 1
    Essentially, what you'll be doing is opening the connection from the other side, and once it's open, both sides can send data until the connection's closed.. but how feasible this is depends on the application and protocol you're using. Can you provide more info about what's required for this connection? Even if the connection must be initiated in a certain direction, you may be able to work around this restriction with creatively applied duct tape. – Shane Madden Nov 20 '14 at 19:02
  • Scenario: I have Web site via which i can control several machines which are playing video files locally. I need to know are those machines alive. Since i can't ping them to know their status. I want to open connection with them so i could ask them are they alive. Also i want to send a command to them like "get config file". So they could know that there is new config file on server so they can download it. Those machines has timers. They are sending their status every 15 minutes and checking for new conf file. But i want to initialize that from my side too – Daniil T. Nov 20 '14 at 19:13

1 Answers1

3

What you'll want to do is to change the logic in the client systems - instead of connecting every 15 minutes, like this:

  • Open TCP connection to controller server
  • Check in
  • Close TCP connection

Have them do this..

  • Open TCP connection to server
  • Identify self, check for config file
  • ..wait for commands..
  • Did the connection fail or get closed? Open it again! (Put a reasonable retry timer in)

This way, the central server can send out data to the nodes when needed, like to update their config files on the fly - each of the video systems will be connected to it and able to immediately accept updates from the server. Push email systems work on essentially this same mechanism - the client holds a connection open to the server and the server can send it new data as soon as it's needed.

Depending on your application architecture, it might make more sense to plug in some kind of message queue system to do this; I'm not familiar with the communication protocol specifics of most of the MQs out there (and if they'll work with your network setup), but something like Redis Pub/Sub seems like it'd be a great fit.

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
  • It makes a sense. But i wa wondering maybe anybody knows any articles or tutorial how to achive it using .net – Daniil T. Nov 23 '14 at 19:07
  • @DaniilT. A good library for using Redis in .net is the one used on this site, which supports pub/sub: https://github.com/StackExchange/StackExchange.Redis And there's great documentation and a link to an example in the Redis docs: http://redis.io/topics/pubsub – Shane Madden Nov 23 '14 at 21:14
  • Oh, sorry mate. I was watching via mobile. Somehow didn't recognize that link. Thank you! You helped me a lot – Daniil T. Nov 24 '14 at 09:47