vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Schützen Sie Ihre Software vor Software-Piraterie - mit sevLock 1.0 DLL!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Ein- und Umsteiger
Ping wenn HOST nicht aufglöst wird 
Autor: cola1
Datum: 23.01.05 10:26

Am besten ich poste mal den Kpl. Code.
class/clsPing.vb


Option Explicit On 
 
Imports System
Imports System.Net
Imports System.Net.Sockets
 
'* Class clsPing
'* Parts of the code based on information from Visual Studio Magazine
'* more info : 
' http://www.ftponline.com/vsm/2002_03/magazine/columns/qa/page3.aspx
'*
Public Class clsPing
 
    Public Structure stcError
        Dim Number As Integer
        Dim Description As String
    End Structure
 
    Private Const PING_ERROR_BASE As Long = &H8000
 
    Public Const PING_SUCCESS As Long = 0
    Public Const PING_ERROR As Long = (-1)
    Public Const PING_ERROR_HOST_NOT_FOUND As Long = PING_ERROR_BASE + 1
    Public Const PING_ERROR_SOCKET_DIDNT_SEND As Long = PING_ERROR_BASE + 2
    Public Const PING_ERROR_HOST_NOT_RESPONDING As Long = PING_ERROR_BASE + 3
    Public Const PING_ERROR_TIME_OUT As Long = PING_ERROR_BASE + 4
 
    Private Const ICMP_ECHO As Integer = 8
    Private Const SOCKET_ERROR As Integer = -1
 
    Private udtError As stcError
 
    Private Const intPortICMP As Integer = 7
    Private Const intBufferHeaderSize As Integer = 8
    Private Const intPackageHeaderSize As Integer = 28
 
    Private byteDataSize As Byte
    Private lngTimeOut As Long
    Private ipheLocalHost As System.Net.IPHostEntry
    Private ipheHost As System.Net.IPHostEntry
 
    Public Property TimeOut() As Long
        Get
            Return lngTimeOut
        End Get
        Set(ByVal Value As Long)
            lngTimeOut = Value
        End Set
    End Property
 
    Public Property DataSize() As Byte
        Get
            Return byteDataSize
        End Get
        Set(ByVal Value As Byte)
            byteDataSize = Value
        End Set
    End Property
 
    Public ReadOnly Property Identifier() As Byte
        Get
            Return 0
        End Get
    End Property
 
    Public ReadOnly Property Sequence() As Byte
        Get
            Return 0
        End Get
    End Property
 
    Public ReadOnly Property LocalHost() As System.Net.IPHostEntry
        Get
            Return ipheLocalHost
        End Get
    End Property
 
    Public Property Host() As Object
        Get
            Return ipheHost
        End Get
        Set(ByVal Value As Object)
            If (Value.GetType.ToString.ToLower = "system.string") Then
                '*
                '* Find the Host's IP address
                '*
                Try
                    ipheHost = System.Net.Dns.GetHostByName(Value)
                Catch
                    ipheHost = Nothing
                    udtError.Number = PING_ERROR_HOST_NOT_FOUND
[u]'hier bleibt er stehen
                    udtError.Description = "Host " & ipheHost.HostName & "" & _
                    "not found."
                End Try
            ElseIf (Value.GetType.ToString.ToLower = "system.net.iphostentry") _
              Then
                ipheHost = (Value)
            Else
                ipheHost = Nothing
            End If
        End Set
    End Property
 
    '*
    '* Class Constructor
    '*
    Public Sub New()
        '*
        '* Initializes the parameters
        '*
        byteDataSize = 32
        lngTimeOut = 500
        udtError = New stcError()
 
        '*
        '* Get local IP and transform in EndPoint
        '*
        ipheLocalHost = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName( _
          ))
 
        '*
        '* Defines Host
        '*
        ipheHost = Nothing
 
    End Sub
 
    '*
    '*   Function : PingHost
    '*     Author : Paulo dos Santos Silva Jr
    '*       Date : 05/09/2002
    '*  Objective : Pings a specified host
    '*
    '* Parameters : Host as String
    '*
    '*    Returns : Response time in milliseconds
    '*              (-1) if error
Ende Teil1
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Ping wenn Host nicht aufglöst wird1.806cola122.01.05 19:34
Re: Ping wenn ost nicht aufglöst wird1.382cola122.01.05 20:12
Re: Ping wenn ost nicht aufglöst wird1.299ModeratorDaveS22.01.05 20:56
Ping wenn HOST nicht aufglöst wird1.573cola123.01.05 10:26
Re: Ping wenn HOST nicht aufglöst wird1.348ModeratorDaveS23.01.05 10:36
Das hab ich verstanden1.340cola123.01.05 11:14
Re: Das hab ich verstanden1.257ModeratorDaveS23.01.05 11:50
Stück weiter1.457cola123.01.05 13:14
Jetzt geht's1.527cola123.01.05 14:05
Re: Ping wenn HOST nicht aufglöst wird1.312cola123.01.05 10:36
Re: Ping wenn ost nicht aufglöst wird1.482cola123.01.05 10:30

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel