| View previous topic :: View next topic |
| Author |
Message |
DavidR Contributor

Joined: 05 Aug 2003 Posts: 83 Location: Bethel Pennsylvania U.S.A.
|
Posted: Tue Jun 05, 2007 11:08 am Post subject: I could use some help with VDSIPP and VDS5 |
|
|
I've had a simple program running for several years now that has been working great. originally written in VDS4 with VDSIPP ver. 2.9.11.2001
I recently decided to recompile the program with VDS5 and VDSIPP ver. 3.1.31.2005.
After doing so it just didn't seem to work properly. After tinkering for a while I figured out that if I added wait statements in key spots it would work but still not as consistantly as before.
I've included a section of the program where I've added wait statements.
Anybody know what I'm doing wrong?
Thanks...
.........David
| Code: |
option scale,96
option fieldsep,|
option decimalsep,.
%P = @PATH(%0)
REM Added for VDS_5
#define command,internet
REM Added for VDS_5
#define function,internet
external %Pvdsipp.dll,DEMO
INIFILE OPEN,%PCONNECT.INI
%%Address = @INIREAD(Connect,Address)
%%Port = @INIREAD(Connect,Port)
%X = @INIREAD(Connect,Database)
%%NAME = @INIREAD(Connect,Name)
%Y = @INIREAD(Connect,Log)
%Z = @INIREAD(Connect,Product)
%%INTERVAL = @INIREAD(Connect,Interval)
%%UPDATE = (None since Program Startup)
title My Program
DIALOG CREATE,My Program,70,117,400,42
DIALOG ADD,LIST,LIST1,6,2,550,30
DIALOG ADD,STATUS,STATUS
DIALOG SHOW
DIALOG SET,STATUS,Just a Moment the Program is Starting Up
:FTP
REM ** CREATE TCP Client 1 and turn Threads ON **
INTERNET FTP,CREATE,1
INTERNET FTP,THREADS,1,ON
INTERNET FTP,CONNECT,1,%%Address
INTERNET FTP,TRANSFERMODE,1,0
REM Added wait statement to work with VDS_5
WAIT 3
REM Create a file to test Network Availability
:MARKER
LIST CREATE,2
LIST ADD,2,DO NOT DELETE THIS FILE
LIST SAVEFILE,2,%XDO_NOT_DELETE.TXT
LIST CLOSE,2
REM Make sure our directory listing is current
INTERNET FTP,REFRESH,1
REM Added wait statement to work with VDS_5
WAIT 5
LIST CREATE,1
LIST CREATE,3
LIST ADD,1,@INTERNET(FTP,FILELIST,1)
REM Added wait statement to work with VDS_5
WAIT 5
REM Not sure why we need to do this but using fileinfo against the original list
REM Returns extra undesired information
LIST ASSIGN,3,1
REM This Checks for .txt files
IF @MATCH(3,txt)
REM Get the name of the first file
%%FILENAME = @INTERNET(FTP,FILEINFO,1,@ITEM(3),N)
GOTO GOOD
END
LIST SEEK,3,0
REM Get the name of the first file
%%FILENAME = @INTERNET(FTP,FILEINFO,1,@ITEM(3),N)
REM If there is no file name returned aparently there is a problem with our FTP
REM connection
IF @NULL(%%FILENAME)
LIST CLOSE,1
LIST CLOSE,3
INTERNET FTP,DESTROY,1
%S = 30
REM Go wait for 30 seconds and go back to try again
GOSUB TIMER1
GOTO FTP
END
Rest of program omitted.....
|
|
|
| Back to top |
|
 |
henrywood Contributor

Joined: 21 Sep 2004 Posts: 66 Location: Copenhagen, Denmark
|
Posted: Tue Jun 05, 2007 11:38 am Post subject: |
|
|
Since you use threads with VDSIPP I would replace the wait statements with wait event,5 or simliar and then handle events under appropriate labels.
I suspect that certain commands fail due to timeout issues (for instance if you are not connected to the FTP server)
Haven't looked to closely at the code though
Henrik |
|
| Back to top |
|
 |
DavidR Contributor

Joined: 05 Aug 2003 Posts: 83 Location: Bethel Pennsylvania U.S.A.
|
Posted: Tue Jun 05, 2007 12:02 pm Post subject: Yes that makes sense! |
|
|
| henrywood wrote: | Since you use threads with VDSIPP I would replace the wait statements with wait event,5 or simliar and then handle events under appropriate labels.
I suspect that certain commands fail due to timeout issues (for instance if you are not connected to the FTP server)
Haven't looked to closely at the code though
Henrik |
Yes I see!
I had threads turned on but clearly didn't fully comprehend the implications. Though I'm not sure why it would have worked fine with the previous versions.
I'm going to turn threads off and try again. I don't need threads in this application as it is all sequential execution.
Thanks..........
................David |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Jun 05, 2007 12:07 pm Post subject: |
|
|
I seem to remember that VDS versions pre 5 did not queue events so one event would overwrite the last, if it was not dealt with. In VDS 5 some events are queued so they are not lost. This means that sometimes you need to do:
while @event()
wend
to clear the event queue if you don't want to process any events that occurred while you were doing something else.
I don't know anything about VDSIPP but this might explain the different behavior. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Jun 05, 2007 4:18 pm Post subject: |
|
|
I concur with Jules... I had to make a lot of changes to GadgetX to support VDS 5's event queue. This is for all VDS DLL writers wishing to post events to VDS 5. You should place the name of the event in a non-volitile queue or some other structure and only remove the name from the non-volitile memory location when that name has been processed by the users VDS script. If you do not you will end up with events that are missing and/or too many events to be processed. I use 2 fuctions in my code to handle events. 1 function places the event into a non-volitile memory location while the other function is called from in the sub-routine in the scirpt to remove the event from the queue. This seems to keep everything in sync. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|