BBC BASIC for Windows
« Using or creating a ppp network connection »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:13pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Using or creating a ppp network connection  (Read 842 times)
acexbe
New Member
Image


member is offline

Avatar




PM


Posts: 10
xx 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
User IP Logged

JGHarston
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 52
xx 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 » User IP Logged

acexbe
New Member
Image


member is offline

Avatar




PM


Posts: 10
xx 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.
User IP Logged

acexbe
New Member
Image


member is offline

Avatar




PM


Posts: 10
xx 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
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls