Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Ping mit Fehlermeldung 10040: Message too long (https://www.delphipraxis.net/116530-ping-mit-fehlermeldung-10040-message-too-long.html)

DevidEspenschied 1. Jul 2008 12:14


Ping mit Fehlermeldung 10040: Message too long
 
Ich habe in einem normalen Formular eine TIdIcmpClient Komponente eingerichtet, weil ich gerne einen Zielhost anpingen möchte. Das funktioniert auch bei existierenden Adressen fehlerfrei.

Sobald ich aber eine nicht existierende Adresse erwische, erhalte ich folgende Meldung: Im Projekt Project1.exe ist eine Exception der Klasse EIdSocketError mit der Meldung 'Socket Error # 10040 Message too long.' aufgetreten.

Der Delphi-Code ist relativ unspektakulär:

Delphi-Quellcode:
IdIcmpClient1.Host:='192.168.5.200';
IdIcmpClient1.Ping('', 0);
IF TReplyStatusTypes <> rsEcho THEN PingError:=True;
Die Meldung soll wohl suggerieren, dass ein Puffer nicht ausreichend dimensioniert ist. Die Suche lieferte aber nix brauchbares. Kann jemand helfen ?

Assertor 1. Jul 2008 13:03

Re: Ping mit Fehlermeldung 10040: Message too long
 
Zitat:

Zitat von devidespe
Delphi-Quellcode:
IF TReplyStatusTypes <> rsEcho THEN PingError:=True;

Das sollte besser:
Delphi-Quellcode:
if IdIcmpClient1.ReplyStatus
heißen.

Ansonsten mal das Timeout hochsetzen?
Delphi-Quellcode:
IdIcmpClient1.ReceiveTimeout := 5000;
Mal zur Erklärung übrigens:
http://www.indyproject.org/docsite/h...ring@word.html
Zitat:

For Windows NT and Windows 2000, administrator privileges are required to allow TIdICMPClient.Ping to work properly. The command line PING application does not exhibit this behavior because Microsoft chose to use undocumented calls in ICMP.DLL and its winsock implementation to get around the issue. In short: they cheated. Indy does not use ICMP.DLL to maintain Linux compatibility, and allow use of both Raw sockets and ICMP sockets.
Gruß Assertor

DevidEspenschied 1. Jul 2008 13:16

Re: Ping mit Fehlermeldung 10040: Message too long
 
Ich habe mittlerweile ParityChecks Quellcode von hier genommen und es funktioniert.

Assertor 1. Jul 2008 13:20

Re: Ping mit Fehlermeldung 10040: Message too long
 
Ok, schreib das doch bitte das nächste mal, bevor ich hier Code und Seiten raussuche und teste :roll:

Gruß Assertor

Codewalker 1. Jul 2008 13:22

Re: Ping mit Fehlermeldung 10040: Message too long
 
Zitat:

Zitat von Assertor
Ok, schreib das doch bitte das nächste mal, bevor ich hier Code und Seiten raussuche und teste :roll:
Gruß Assertor

Macht nichts, andere (z.B. ich :mrgreen:) haben dadurch wieder etwas gelernt :thumb:

DevidEspenschied 1. Jul 2008 13:24

Re: Ping mit Fehlermeldung 10040: Message too long
 
Zitat:

Zitat von Assertor
Ok, schreib das doch bitte das nächste mal, bevor ich hier Code und Seiten raussuche und teste :roll:

Gruß Assertor

Sorry, aber es musste eben schnell gehen. Trotzdem danke für Deine Mühe.

Assertor 1. Jul 2008 13:29

Re: Ping mit Fehlermeldung 10040: Message too long
 
Zitat:

Zitat von Codewalker
Macht nichts, andere (z.B. ich :mrgreen:) haben dadurch wieder etwas gelernt :thumb:

Zitat:

Zitat von devidespe
Sorry, aber es musste eben schnell gehen. Trotzdem danke für Deine Mühe.

Ok, Ihr habt ja recht. War ja auch noch nicht so alt der Thread :)

Gruß Assertor
:dp:


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz