Hi List
I'm having a bit of a problem with getNetText(). Sometimes it works,
sometimes it doesn't and now it's not working at all.
I have a project already built that uses getNetText() to retrieve an XML
file from the web to update internal data. This routine runs inside an
exitFrame handler that loops until everything's downloaded and parsed, and
then advances to another frame. Additionally, I use getNetText to retrieve a
dummy text file from the web purely to test if there is an active internet
connection. This routine runs inside a stepFrame handler after the script
has been added to the actorList.
The problem I'm having is that the XML downloader works perfectly well and
does its thing, but the dummy file check will _always_ claim there is no
internet connection. Now this phenomenon has only started happening recently
and only in my office - I've been using the same script since the first
version of this last September and only now does it now work, yet it works
perfectly well on other internet connections.
My initial thought was it's some kind of proxy problem or something because
we've upgraded our connectivity recently to run a few in-house web servers.
Attached is the code for both, but I've removed some stuff that isn't
relevant.
XML DOWNLOADER
-- Properties
property pXML
property pState, pNetID
-- Events
on beginSprite me
me.Initialise()
end
on exitFrame me
case pState of
#loading:
if netDone(pNetID) then
case netError(pNetID) of
0, "OK": -- everything is fine
xmlData = netTextResult(pNetID)
pXML.parseString(xmlData)
pState = #parsing
4146: -- no connection
pState = #failed
go("NoConn")
otherwise -- anything else
go("NoFile")
end case
end if
end case
-- loop
go to the frame
end
-- Handlers
on Initialise me
-- create XML Parser
pXML = new (xtra "XMLParser")
pXML.ignoreWhiteSpace(TRUE)
-- start to load XML from the web
xmlFile = "http//www.bulldogbroadband.com/xml/dataset.xml"
pNetID = getNetText(xmlFile)
-- initialise
pState = #loading
end
CONNECTIVITY CHECK
-- Properties
property pURL, pLoadMarker, pOKMarker, pFailMarker
property pState, pResult
-- Events
on mouseUp me
me.Initialise()
end
on stepFrame me
case pState of
#checking:
if netDone(pResult) then
case netError(pResult) of
4146: -- no connection
go(pFailMarker)
me.Destroy()
otherwise -- active connection, ignore error
go(pOKMarker)
gotoNetPage(pURL)
me.Destroy()
end case
end if
end case
end
-- Handlers
on Initialise me
pResult = getNetText("http//www.theMmen.co.uk/test.txt")
pState = #checking
(the actorList).add(me)
go(pLoadMarker)
end
on Destroy me
pResult = void
pState = #destroy
(the actorList).deleteOne(me)
end
As you can see I'm pretty much doing the same thing in both to check for the
existence of the online file, but the actorList version will always report
there's no connection i.e. netError always returns 4146.
Now to compound the problem, I've tried writing both exitFrame and stepFrame
scripts in a new project to see what's going on and now nothing works!
getNetText() is always returning 4146, even through the Message window.
Does anybody have a clue what's going on here?
Sorry for the long message, thanks in advance.
Ross
___________________________________________________________
24 FIFA World Cup tickets to be won with Yahoo! Mail http://uk.mail.yahoo.com
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]