BBC BASIC for Windows
Programming >> Communication and Input/Output >> Using or creating a ppp network connection http://bb4w.conforums.com/index.cgi?board=communication&action=display&num=1296814867 Using or creating a ppp network connection
Post by acexbe on Feb 4th, 2011, 09:21am
I need to transfer files using ftp through a serial ppp connection. I created a new network connection and set it up as ppp.
The transfer works ok (see Wiki: Uploading files to an FTP server and MSDN WinINet).
But I have to start the ppp connection first. Is there a possibility to start a preconfigured network connection (in this case the ppp one)? Or even better, would it be possible to handle the creation and startup of a ppp in software.
Thanks,
Manuel
Re: Using or creating a ppp network connection
Post by JGHarston on Feb 4th, 2011, 7:41pm
3) REM do systemcommand invisible REM returns the exit info REM waits until the command is executed
exitcode%=FNexecuteandwait("rasdial","name_of_ppp_connection ppp_password","c:",0) PRINTexitcode% IF exitcode%=0 PRINT"Connected" IF exitcode%=623 PRINT"Wrong connection name" IF exitcode%=691 PRINT"Wrong username or password" IF exitcode%=777 PRINT"No serial connection" WAIT 400 exitcode%=FNexecuteandwait("rasdial","PPP /disconnect","c:",0) PRINTexitcode% IF exitcode%=0 PRINT"Disconnected"
END
DEF FNexecuteandwait(prog$,parm$,cdir$,show%) LOCAL sei{}, res% DIM sei{cbSize%,fMask%,hwnd%,lpVerb%,lpFile%,lpParameters%,lpDirectory%,nShow%, \ \ hInstApp%,lpIDList%,lpClass%,hkeyClass%,dwHotKey%,hIcon%,hProcess%} prog$ += CHR$0 parm$ += CHR$0 cdir$ += CHR$0 sei.cbSize% = DIM(sei{}) sei.fMask% = 64 : REM SEE_MASK_NOCLOSEPROCESS sei.hwnd% = @hwnd% sei.lpFile% = !^prog$ sei.lpParameters% = !^parm$ sei.lpDirectory% = !^cdir$ sei.nShow% = show% SYS "ShellExecuteEx", sei{} IF sei.hProcess% = 0 THEN = 1067 REPEAT SYS "WaitForSingleObject", sei.hProcess%, 100 TO res% UNTIL res%<>258 : REM WAIT_TIMEOUT SYS "GetExitCodeProcess", sei.hProcess%, ^res% SYS "CloseHandle", sei.hProcess% =res%