English
Forum

Ping Tool from CMD

 
- Page 1 -



Penguin
Tux
Hi,

i want me ersteinmal present. my name is Tony, i'm 15 years old and visit a six-year secondary school in Chemnitz. Since I now Sommerferien have what about me nothing moreover To do have, have I me undertaken one small Netzwerkanalysetool To write. on the Search after a einfachen Programming-Language be I on XProfan punched.

I have everything nötige gedownloaded and installs, connect have I to one Pingcode sought and I this:
declare pingstring$,ping$,ping%
********************************************************************

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

ENDPROC

********************************************************************
Description:
it gives of course already a speedy and nice Onlineabfrage über API,
but unfortunately gives The function only 1 for Online back, if
one über one Standart DFÜ eingewählt is.
These procedure is hold only something slower but one can even DSL
(means - no DFÜ-link) or the old T-Online u.s.w inquire!!
everything with one star umrandete is important for The request
Rolf cook - Rokosoftware - Koblenz 2002
BEISPIEL
WINDOWSTYLE 31
Window 200,200-300,80
Windowtitle "Onlinstatus-check without Api"
Text Color RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..momentum ermittele!"
HIER JETZT THE AUFRUF THE PROZEDUR:********************
PING ADRESSE,ERGEBNISDATEI,BATCHDATEI
Parameter
1.) Webadresse - a always available How www.nic.de
2.) Dateiname, in which Pingergebnis written becomes - becomes again deleted!
3.) Dateiname, circa Ping correctly aufzurufen. - becomes again deleted!
********************************************************
Text Color RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "TIMES NEW ROMAN",25,20,1,0,0
Text Color RGB(0,0,255),-1
Ping "192.168.0.7","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    DRAWTEXT 25,10,"Erreichbar"

else

    DRAWTEXT 25,10,"Nicht erreichbar"

endif

waitinput

Diesen code have I me to my Bedürfnissen zurechtgeschnitten and it sees How follows from. moreover should I The of me ausgedachte Funktionsweise explain.

its planned, I one Tool write, which possible simply a first Help for schoolboy and teacher bid. notice one User the it none Internetzugang has, lead it the Tool from, which the row to first whom Server anpingt, then a others Client the network and then yet a computer of outside (z.B. Date). If it with of/ one the steps no feedback gives, should a Message with hints to removal on the Bildschrim attend.

now to that code:
declare pingstring$,ping$,ping%

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

ENDPROC

WINDOWSTYLE 31
Window 200,200-500,80
Windowtitle "Onlinstatus-check without Api"
Text Color RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..momentum ermittele!"
Text Color RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "CANDARA",25,20,1,0,0
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server not erreichbar"

endif

Ping "192.168.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Client Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Client not erreichbar"

endif

Ping "www.google.de","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Google Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Google not erreichbar"

endif

waitinput

One trouble, which itself to Time auftut, is the fact the the Fensterinhalt not gelöcht becomes. that is the "Server Erreichbar", "Client Erreichbar" and "Google Erreichbar" übereinander written go, means need I a Possibility whom Content the Fensters to each step To delete. thereby be on

punched. Nutze I these Possibility to or. to "Server Erreichbar" becomes "Server Erreichbar" none displayed.

for a small Hilfestellung would I very grateful.

thanks
Tony
 


OS: Win XP/Debian
XProfan 10
07/20/08  
 



 
- Page 9 -



Stefan
Landsberg
Stefan Löwen
%hwnd do you need imho not deklarieren. by me goes anyway too without it before To deklarieren. (To late. rolf was faster)

I have with my Program again integrally of in front started and I jetz a couple ask.
beforehand first the actually status my program:
CompileMarkSeparation
Declare-Teil:
declare ping%, btn%
Proc-Teil:

Proc Ping

    declare pingdatei1$, pingdatei2$, pingstring$, ping$
    Parameters ip$
    let pingdatei1$="PINGTEST.TXT"
    let pingdatei2$="PING.BAT"
    let pingstring$="PING.EXE",ip$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT @EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

EndProc

Def-Teil:
DEF GetSysColor(1) !"User32","GetSysColor"
Fenster erstellen:
WindowStyle 63
WindowTitle "IP Checker"
Window @SUB(@DIV(%maxX,2),300),@SUB(@DIV(%maxY,2),250) - 600,500
SetTrueColor 1
CLS GetSysColor(15)
@CreateMultiEdit(%HWnd,"",10,50,570,-200)
btn%=@CreateButton(%HWnd,"Überprüfen",250,260,100,30)
WaitInput

in the EditBox to the User a list of IPs or its Aliase through absätze (to hardship too kommata or semikola) separated prompt.

my target is it for each this IPs a ping request To make.

How make I the best?

my idea:
whom content the editbox with @GETLINE$ in a Memory-Variable reading, and then somehow each ip in a string variable write. where a new ip anfäng recognize one Yes on whom absätzen (but How say I the the Program).

thereafter simply with eachone variable following request make:

ping variable$

if The idea well and umsetzbar is would it nice if someone me with the umsetzung help would.
if The idea not so well is, would a new idea very helpful


I have the code feeling, that my posting somehow overlooking watts.
I Please simply nocheinmal circa Help
 
07/23/08  
 




Rolf
Koch
Have time my idea grade umgesetzt. some went kürzer, but it should Yes clear and simply declared his.
what You yet make must: fit whom code again To Profanversion 6.6 on, I over the newest Interpreter tested have and add, inc and co not any more present are what about me now no Time More have.
input through space separated! spending the Result results against in that Eingabefenster (could too assembled showing and not particular - How said Time To concise). can also through Schnelltippen his, I ne Kleinigkeit overlooking or forget have - but You must indeed what moreover contribute ^^
Declare-part:
declare ping%, btn%,end%,ipedit&,ipinhalt$,i%
declare characters$,zeichenalt$
Proc-part:

Proc Ping

    Ping%=0
    declare pingdatei1$, pingdatei2$, pingstring$, ping$
    Parameters ip$
    let pingdatei1$="PINGTEST.TXT"
    let pingdatei2$="PING.BAT"
    let pingstring$="PING.EXE",ip$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT @EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case ping$="Antwort von":Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

ENDPROC

Def-part:
DEF GetSysColor(1) !"User32","GetSysColor"
Window create:
Window Style 63
Window Title "IP Checker"
Window @SUB(@DIV(%maxX,2),300),@SUB(@DIV(%maxY,2),250) - 600,500
Window 10,10-600,500
SetTrueColor 1
CLS GetSysColor(15)
ipedit&=@CreateMultiEdit(%HWnd,"",10,50,570,-200)
btn%=@CreateButton(%HWnd,"Überprüfen",250,260,100,30)

Whilenot end%

    waitinput

    if clicked(btn%)

        characters$=""
        zeichenalt$=""
        ipinhalt$=GetText$(ipedit&)

        if mid$(ipinhalt$,len(ipinhalt$),1) <> " " ensuring Abschlusszeichen

            ipinhalt$=ipinhalt$+" "

        endif

        i%=1

        whilenot i% = len(ipinhalt$)+1

            characters$=mid$(ipinhalt$,i%,1)
            inc i%

            if characters$ <> " "

                characters$=zeichenalt$+characters$
                zeichenalt$=characters$

            else

                ping zeichenalt$		      here Ping Result

                if ping%=1

                    settext ipedit&,zeichenalt$+" is verfügbar"

                else

                    settext ipedit&,zeichenalt$+" isn't verfügbar"

                endif

                zeichenalt$=""

            endif

        endwhile

    endif

Endwhile

 
07/23/08  
 




Stefan
Landsberg
THANK YOU Rolf the only what Profan 6.6 bemängelt is the function clicked. but the Have I simply through getfocus supplant.

Have me jetz thoroughly with your code befasst and Have it understood

jetz must I it nurnoch somehow umändern so it of my is, and then must I it in my Program einarbeiten.
 
07/23/08  
 




Rolf
Koch
Freut me, that You it adopted have and this too understood have!
 
07/23/08  
 




Stefan
Landsberg
Hi,

I have jetz Rolfs code in my Program eingebunden. as i so ready was wished I only yet the characters of space on distribution umändern.
there's me noticed, that to the with absätzen rather with @getlinecount and @getline$ release can.

To jetz sees the by me so from: [...] 

but somehow comes the Program by me in ne endlosschleife and fäng, after it whom status the last ip outputted has, again from the first ip on.
I know but simply not where my Error is.

PS: the design map I To improve.

Edit: be jetz already something moreover. the error lying in row 56. @getlinecount(ipinput%) supply a number in the millionenbereich. its means no endlosschleife. tappt im dunkeln lasts only very long! joke with Page:
Why Gibts getlinecount so a grosse number back?
I thought there's The zeilenanzahl on. and the lying with my tests with 2 To 4. and not millionenbereich!
 
07/24/08  
 



Stefan Löwen
be jetz already something moreover. the error lying in row 56. @getlinecount(ipinput%) supply a number in the millionenbereich. its means no endlosschleife. tappt im dunkeln lasts only very long! joke with Page:
Why Gibts getlinecount so a grosse number back?
I thought there's The zeilenanzahl on. and the lying with my tests with 2 To 4. and not millionenbereich!


and very this is z.B. one completely new Topic - with a own Minimalbeispiel. ;)
 
07/24/08  
 




Stefan
Landsberg
Dou you mean I should a new thread eröffnen or what wanted You me say?
 
07/24/08  
 



Yes, Please.
 
07/24/08  
 




Stefan
Landsberg
profane has what against me.
jetz i was already thereby my trouble in a new thread To narrate and wished whom code post. there Have I the Program once more quick go through let, and what happens?!?

@GetLineCount gives whom right worth back

naja, I freu me rather, that it jetz goes and make moreover. i will latterly the 6 pages yet my erstes Program to feature
 
07/24/08  
 



Exakt therefore my Please to that new Thread - there becomes one hereon hingewiesen one  [...]  abzuliefern - let time until end and lach...
 
07/24/08  
 




Stefan
Landsberg
the story with the minimalbeispiel of Roland Hennrich kenn I already

but I had the program a little while ago at least 5 time tested and @getlinecount was broken

what about me wished no minimal example post, separate whom kompletten code (can but too minimal name ) Have means nothing changed and at a single blow I ment.

naja I must not so plenty write, otherwise war I my Program not any more on Page 6
 
07/24/08  
 



I found "Roland Hennrich" fit...
 
07/24/08  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

23.592 Views

Untitledvor 0 min.
Georg Teles08/01/23
Thomas Freier10/06/22
Langer01/30/21
Walter01/29/19
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie