Author |
Topic: Using or creating a ppp network connection (Read 842 times) |
|
acexbe
New Member
member is offline


Posts: 10
|
 |
Using or creating a ppp network connection
« Thread started 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
|
|
Logged
|
|
|
|
JGHarston
Junior Member
member is offline


Gender: 
Posts: 52
|
 |
Re: Using or creating a ppp network connection
« Reply #1 on: Feb 4th, 2011, 7:41pm » |
|
on Feb 4th, 2011, 09:21am, acexbe wrote: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)? |
|
Can you configure the PPP subsystem to connect on demand?
|
« Last Edit: Feb 4th, 2011, 7:41pm by JGHarston » |
Logged
|
|
|
|
acexbe
New Member
member is offline


Posts: 10
|
 |
Re: Using or creating a ppp network connection
« Reply #2 on: Feb 5th, 2011, 09:01am » |
|
Can you configure the PPP subsystem to connect on demand?
No, I have to login each time.
|
|
Logged
|
|
|
|
acexbe
New Member
member is offline


Posts: 10
|
 |
Solved: Using or creating a ppp network connection
« Reply #3 on: Nov 27th, 2011, 09:38am » |
|
Hello, I found the system command to start the ppp-connection, its "rasdial". Here are 3 ways to do it. (thanks to the BB4W documentation)
1) REM execute the systemcommand REM last parameter: 1=cmd visible 0= cmd not visible REM no exit info REM BB4W does not wait for the command SYS "ShellExecute",@hwnd%,0,"rasdial", "name_of_ppp_connection ppp_password","c:",0
2) REM do systemcommand with visible cmd screen REM gives the exit info REM BB4W does not wait for the command program$="name_of_ppp_connection ppp_password" PRINT"Command started" F%=OPENOUT"RUN.BAT" PRINT#F%,program$:BPUT #F%,10 PRINT#F%, "ECHO %ERRORLEVEL% > EXITCODE.TXT":BPUT#F%,10 CLOSE#F% *RUN RUN.BAT F%=OPENIN"EXITCODE.TXT" INPUT #F%,exitcode$ CLOSE#F% exitcode%=VAL(exitcode$) PRINT"Exit code= ";exitcode%
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%
Solution 3 is the way to do it.
Regards,
Manuel
|
|
Logged
|
|
|
|
|