Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


iHostConnect and Return Codes

Keywords: 

Question:

In the following script, why does iHostConnect return a handle for this bogus URL?
AddExtender("WWINT34i.DLL")
tophandle=iBegin(0,"","")
conhandle=iHostConnect(tophandle,"www.aksdfhkfhlksdfhklf.org",@HTTP, "","")
message(iGetResponse(),conhandle)
;conhandle=iHostConnect(tophandle,"www.worldwideschool.org",@HTTP, "","")
datahandle=iHttpInit(conhandle, "GET", "/", "",0)
rslt=iHttpOpen(datahandle, "", 0, 0)
xx=iReadData(datahandle, "C:\temp\abc.txt")
iclose(datahandle)
iClose(conhandle)
iClose(tophandle)
Message("All","Done")
exit

Answer:

ihostconnect is not designed to validate a hostname. To capture an error for an invalid host you would have to execute the httpinit inorder to get a HTTP response...
AddExtender("WWINT34i.DLL")
tophandle=iBegin(0,"","")
conhandle=iHostConnect(tophandle,"www.aksdfhkfhlksdfhklf.org",@HTTPS,"","")
datahandle=iHttpInit(conhandle, "GET", "/", "",0)
rslt=iHttpOpen(datahandle, "", 0, 0)
message("ERROR",igetlasterror())

Article ID:   W14807