Timeout was reached(28)

Discuss any general programming issues here
Post Reply
amyren
Posts: 361
Joined: Thu May 02, 2019 11:53 am

Timeout was reached(28)

Post by amyren »

I am trying to set up a program that can run unattended as a host.
And when testing the program I found that after a while this requester sometimes pops up:
"Timeout was reaced(28)"

I was thinking this might be a network related message, so I tried to create a minimal example to reproduce the the issue.
Shortly explained what the program does host does is It will upload a couple of text files every 10 second, and also check the ftp server for incoming messages every 5 second by two SetInterval commands.
But running the minimal example I can not reproduce the message.

I did try with various SetNetworkTimeout values, but that did not seem to have any effect on this issue.
Also reading the hurl documentation and see that there a lot of timeout options in there, and I'm not sure if any of those options are relevant in this case.

To investigate further, I would like to know what generates this message. Is it a part of hurl that detects a timeout and have this text as a defaut system message?
And can that number 28 tell anything?
User avatar
airsoftsoftwair
Posts: 5446
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Timeout was reached(28)

Post by airsoftsoftwair »

That 28 is the cURL error. See here: https://wordpress.org/support/topic/cur ... -10000-ms/

If you can't reproduce the problem in an MCVE, can you run your script from a console with the "-debugoutput" argument and see which command throws the error?
amyren
Posts: 361
Joined: Thu May 02, 2019 11:53 am

Re: Timeout was reached(28)

Post by amyren »

Thanks. It helped me to find where the message came from. I havent tried using the console for debugoutput before, it looks quite useful.
It was a systemrequest I had forgotten to disable for the demo-mode, in the code for ftp directory listing.

Code: Select all

Function p_hurlinit()
	e = hurl.Easy()
	e:setopt_default_protocol(prot$)
	If ftpusername$ Then e:setopt_username(ftpusername$) Else e:unsetopt_username()
	If ftppassword$ Then e:setopt_password(ftppassword$) Else e:unsetopt_password()
	If port>0 Then e:setopt_port(port) Else e:unsetopt_port()
	e:setopt_noprogress(1) ; Let's disable the progress (meter) function
EndFunction

Function p_Comm_GetDir(dir$)
    e:setopt_writefunction(p_Comm_WriteStr) ; Set write function to string in the memory, instead of a file on hd or so
    tr_data$ = "" ; And clear our global string to write
    e:setopt_dirlistonly(1) ; If this is enabled, you only get file/dir names, but no other info
    p_Comm_Transfer(FullPath(ftpserver$.."/", dir$)) ; After this our global string has the raw unparsed dir listing
EndFunction

Function p_Comm_WriteStr(data$)
    tr_data$ = tr_data$ .. data$
EndFunction

Function p_Comm_Transfer(url$)
    e:setopt_url(url$)
    ExitOnError(False)
    e:perform()
    err=GetLastError()
    ExitOnError(True)
    If err <> 0
	SystemRequest("An error occurred!",GetErrorName(err),"OK")
    EndIf
EndFunction
Most of the code above is copied from an example code I found elsewhere.

Now I have just replaced this part with an error counter

Code: Select all

    If err <> 0
	If demomode
		timeouts = timeouts+1
		Box(500, 1015, 350, 50, $EFE3AF)
		SetFont(#SERIF, 40)
		SetFontColor(#RED)
		TextOut(500, 1015, "Timeouts = "..timeouts)
	Else
		SystemRequest("An error occurred!",GetErrorName(err),"OK")	
	EndIf
    EndIf
Post Reply