Alaska Software Inc. - LoadFromUrl returns NIL
Username: Password:
AuthorTopic: LoadFromUrl returns NIL
Jose Adriano Baltieri LoadFromUrl returns NIL
on Tue, 12 Mar 2013 08:40:30 -0300
Hello !

I have a kind of a server of my own, that is a multi-threaded app written in XPP.

I accepts connections via TCP/IP from OUTSIDE and issues a LoadFromURL to 
INSIDE, that is, to localhost (127.0.0.1).

I then gets a url and returns it to OUTSIDE as as string.

It happens that sometimes LoadFromURL returns NIL and I don't know WHY , that 
is, if it is a timeout problem or a TCP/IP exhaustion one.

Say that Windows (2003 R2) is running out of some resource or whatever.

The question is : when LoadFromURL returns NIL , I need to know why it happened...

tHanXs !
Thomas BraunRe: LoadFromUrl returns NIL
on Wed, 13 Mar 2013 08:54:31 +0100
Jose Adriano Baltieri wrote:

> 
> The question is : when LoadFromURL returns NIL , I need to know why it happened...

I think you don't have any finer control at all, this is what teh docs say:

> The return value NIL indicates a connection failure which can have
> several reasons: The URL does not exist, illegal parameters are passed,
> the HTTP server is offline or there is no TCP/IP connection at all. If
> there is no TCP/IP connection but the computer is configured for a
> dial-up connection via modem, the operating system will open the dial-up
> dialog to establish a connection.

So either you use the low-level socket functions and create your own HTTP
client function or you save yourself a lot of time and get xb2net from
Boris and use xbHTTPClient class:

> Execute(xURI, [cCommand], [xPostContent], [aHTTPHeaders], [xRecvFile]) -> oHTTPResponse | NIL 
> Send a request to a remote HTTP server and receive response. If
> successful, the method returns a reference to an xbHTTPResponse instance
> containing the deserialized response returned by the remote HTTP server.
> If an error occurs, the method returns NIL. The cause of the error can
> be determined by inspecting values saved in the :ErrorCode, :ErrorMessage 
> and :ErrorSource instance variables. 

HTH
Thomas