System.Net.NetworkInformation.Ping funktioniert nicht wie sie soll

  • VB.NET
  • .NET (FX) 4.5–4.8

Es gibt 4 Antworten in diesem Thema. Der letzte Beitrag () ist von Radinator.

    System.Net.NetworkInformation.Ping funktioniert nicht wie sie soll

    Hi
    also ich hab ein Ping Programm, das ein Unterprogramm ist, geschrieben. Das soll mir eine ICMP an eine IP in Netzwerk senden:

    Visual Basic-Quellcode

    1. Dim ping as new System.Net.NetworkInformation.Ping
    2. Dim reply as String
    3. Dim time as String
    4. With ping.Send(<ip>, 500)
    5. reply = .Status.toString
    6. time = .RoundTripTime
    7. End With

    Ich lass mir dann reply und time zusammen mit Now & ": & Now.Milliseconds ausgeben und seltsamerweise steht in reply ein "TimedOut" drinnen, wo die RoundTripTime 0ms hat.
    Als erstes dachte ich kann doch ned sein, dann kam mir der Verdacht, evtl is die RTT(=RoundTripTime) >1000ms...aber ann würds ja dastehen. Aber mittlerweile verstehe ich des echt nicht
    mehr, warum mit der so nen Sch... ausgibt. Ich mein entweder hab ich mir da in der Ausgabe vertan und seh meine Fehler nicht oder des .NET arbeitet ned so wie es soll(was ich ehrlich gesat bezweilfe...)
    Evtl. is das schon ma jemanden passiert, bitte um Rückmeldung, danke!!!
    In general (across programming languages), a pointer is a number that represents a physical location in memory. A nullpointer is (almost always) one that points to 0, and is widely recognized as "not pointing to anything". Since systems have different amounts of supported memory, it doesn't always take the same number of bytes to hold that number, so we call a "native size integer" one that can hold a pointer on any particular system. - Sam Harwell
    Danke für den Tip, aber des hab ich gestern schon gemacht und da bekomm ich keinen Timeout. Habs auch schon parallel versucht, da hat mir des .NET auch "TimedOut" mit RTT=2ms angezeigt, während der CMD-Ping ganz normal ...Zeit=2ms... gemeldet hat
    In general (across programming languages), a pointer is a number that represents a physical location in memory. A nullpointer is (almost always) one that points to 0, and is widely recognized as "not pointing to anything". Since systems have different amounts of supported memory, it doesn't always take the same number of bytes to hold that number, so we call a "native size integer" one that can hold a pointer on any particular system. - Sam Harwell
    Wenn ich den eigens eingestellten TimeOut von 500 wegmache(was im prinzip nichts bringt, weil sowieso standardmäßig 500 eingestellt sind, wenn der user sonst nix anders eingibt...verzeihung der programmierer) gibt er mir wenn ich den System.Net.NetworkInformation.Ping wieder bei 0ms RTT ein "TimedOut" zurück und beim My.Computer.Network.Ping hat er keinen einzigen "Ausfall", sprich gibt kein einziges mal "False" zurück
    In general (across programming languages), a pointer is a number that represents a physical location in memory. A nullpointer is (almost always) one that points to 0, and is widely recognized as "not pointing to anything". Since systems have different amounts of supported memory, it doesn't always take the same number of bytes to hold that number, so we call a "native size integer" one that can hold a pointer on any particular system. - Sam Harwell