Azure / azure-event-hubs-c

C client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
Other
7 stars 18 forks source link

network availability check #58

Open sysmoon opened 4 years ago

sysmoon commented 4 years ago

If I continue to call the send () function in a non-network situation, there is a problem that the process dies due to an infinite loop and excessive use of stack memory. If there is no network, the log cannot be sent and the queue is accumulated, which seems to be the result. Is there an option to check network availability in code?

sysmoon commented 4 years ago

To share more detailed information. Because our device communicate through the VPN Server located in On-Premise and there are lots of network security policy. so we will make network policy for communication with azure eventhub. there are no problem. but most import things.. device should be checked network availability against azure eventhub. no ping test target www.google.com.

dcristoloveanu commented 4 years ago

@sysmoon There isn't any built in function in the event hubs C sdk to check for availability. A simple connectivity test is just opening a socket to the event hub address for port 5671 (AMQPS) for example. If the socket connects then there is connectivity to the Event Hub (and socket can be closed).

Under the hood the SDK does the same (it will open a socket on 5671 and of deal with the whole TLS handshake, AMQP handshake, etc.

HTH, /Dan

sysmoon commented 4 years ago

As you advised I will check network availability using BSD socket. thanks a lot.

/Sysmoon