check if there is connection to server

irade92

Registered User.
Local time
Today, 17:04
Joined
Dec 26, 2010
Messages
229
Hi
In the code below I want to wait for ten seconds if there is connection to the server, if not to exit the sub with message "No connection to server"
How to check it

Dim req As New XMLHTTP60
Dim resp As New DOMDocument60
Dim xmlNodeList As IXMLDOMNodeList
Dim myNode As IXMLDOMNode
Dim xmlNode As IXMLDOMNode
Dim presription As IXMLDOMNode

req.Open "GET", "https://api.zdravstvo.gov.mk/rest/prescriptions/" & Me.br_recept, False


req.send
resp.LoadXML req.responseText

thanks in advance for any help!!
 
Look up SetTimeouts method for XMLHTTP60 object.

Also see here http://stackoverflow.com/questions/551613/check-for-active-internet-connection

Somewhere there is a list of status codes returned. Google.

Thanks for very quick response...Hope this will help..I will try soon...

How to implement this in VBA..there is no setTimeouts method...
var xmlServerHttp = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0");
var lResolve = 5 * 1000;
var lConnect = 5 * 1000;
var lSend = 15 * 1000;
var lReceive = 15 * 1000;
xmlServerHttp.setTimeouts(lResolve, lConnect, lSend, lReceive);
xmlServerHttp.open("GET", "http://localhost/sample.xml", false);
xmlServerHttp.send();
 
Last edited:

Users who are viewing this thread

Back
Top Bottom