Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PING and DELPHI

1,126 views
Skip to first unread message

Craig Cmehil

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
I am trying to ping mulitple IP's in a delphi app right now I've tried
using the NMEcho component and the PowerSock Component but no luck I
need to be able to check an IP to see if it active or not.

Help would be appreciated!!

Craig Cmehil


Daaron Dwyer

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
There is a ping component (nmtracert) from NetMasters.
For free, I think that Francois Piette has some components to do this,
available anywhere.

Craig Cmehil <cme...@hellausa.com> wrote in message
news:371FA0BA...@hellausa.com...

François Piette

unread,
Apr 23, 1999, 3:00:00 AM4/23/99
to
> For free, I think that Francois Piette has some components
> to do this, available anywhere.

I have a TPing component available in my freeware ICS package.
Download source code (ICS.ZIP) from http://www.rtfm.be/fpiette/indexuk.htm

--

francoi...@pophost.eunet.be
The freeware Internet Component Suite maker
The freeware MidWare middleware maker
Download from http://www.rtfm.be/fpiette/indexuk.htm


François Piette

unread,
Apr 27, 1999, 3:00:00 AM4/27/99
to

> I am trying to ping mulitple IP's in a delphi app right now

Use ICS's TPing component. It's free, include full source code and works
with any 32 bit Delphi version (D2/D3/D4) and also BCB. Download source

Brooks Vaughn

unread,
May 13, 1999, 3:00:00 AM5/13/99
to
I have tried Delphi-4's C/S NMEcho too with no success at all.

I have tried ICS (http://www.rtfm.be/fpiette/) component too but it seems
to fail to connect after I have successfully ping'd the first 25 computers
then it fails on the remaining PC's. My list of computer names are between
220 and 840. :(...

I just need a clean simple way to test to see if a PC on the LAN is
reachable or not.

Please let me know if anyone has had success. Code samples are always a
super help.

Brooks Vaughn
bro...@tidalwave.net

Francois Piette

unread,
May 17, 1999, 3:00:00 AM5/17/99
to
>I have tried Delphi-4's C/S NMEcho too with no success at all.
>
>I have tried ICS (http://www.rtfm.be/fpiette/) component too but it seems
>to fail to connect after I have successfully ping'd the first 25 computers
>then it fails on the remaining PC's. My list of computer names are between
>220 and 840. :(...


You probably have a problem on your system because I use ICS ping component
to continuesly ping the 600 computers attached to our lan and trigger alarms
when needed.

You should get latest winsock version (win95/98) or service pack (NT) from
Microsoft website.

Mike Cariotoglou

unread,
May 18, 1999, 3:00:00 AM5/18/99
to
In article <371FA0BA...@hellausa.com>, cme...@hellausa.com says...

> I am trying to ping mulitple IP's in a delphi app right now I've tried
> using the NMEcho component and the PowerSock Component but no luck I
> need to be able to check an IP to see if it active or not.
>
> Help would be appreciated!!
>
> Craig Cmehil
>
>

here is the api of ICMP.DLL , which is what windows uses for the
implementation of PING. have fun. I know it works, I am using it on a
watchdog program..

unit icmp;

interface

uses windows;

Const


//
// IP_STATUS codes returned from IP APIs
//
IP_STATUS_BASE = 11000;
IP_SUCCESS = 0;
IP_BUF_TOO_SMALL = (IP_STATUS_BASE + 1);
IP_DEST_NET_UNREACHABLE = (IP_STATUS_BASE + 2);
IP_DEST_HOST_UNREACHABLE = (IP_STATUS_BASE + 3);
IP_DEST_PROT_UNREACHABLE = (IP_STATUS_BASE + 4);
IP_DEST_PORT_UNREACHABLE = (IP_STATUS_BASE + 5);
IP_NO_RESOURCES = (IP_STATUS_BASE + 6);
IP_BAD_OPTION = (IP_STATUS_BASE + 7);
IP_HW_ERROR = (IP_STATUS_BASE + 8);
IP_PACKET_TOO_BIG = (IP_STATUS_BASE + 9);
IP_REQ_TIMED_OUT = (IP_STATUS_BASE + 10);
IP_BAD_REQ = (IP_STATUS_BASE + 11);
IP_BAD_ROUTE = (IP_STATUS_BASE + 12);
IP_TTL_EXPIRED_TRANSIT = (IP_STATUS_BASE + 13);
IP_TTL_EXPIRED_REASSEM = (IP_STATUS_BASE + 14);
IP_PARAM_PROBLEM = (IP_STATUS_BASE + 15);
IP_SOURCE_QUENCH = (IP_STATUS_BASE + 16);
IP_OPTION_TOO_BIG = (IP_STATUS_BASE + 17);
IP_BAD_DESTINATION = (IP_STATUS_BASE + 18);
//
// The next group are status codes passed up on status indications to
// transport layer protocols.
//
IP_ADDR_DELETED = (IP_STATUS_BASE + 19);
IP_SPEC_MTU_CHANGE = (IP_STATUS_BASE + 20);
IP_MTU_CHANGE = (IP_STATUS_BASE + 21);
IP_UNLOAD = (IP_STATUS_BASE + 22);
IP_GENERAL_FAILURE = (IP_STATUS_BASE + 50);
MAX_IP_STATUS = IP_GENERAL_FAILURE;
IP_PENDING = (IP_STATUS_BASE + 255);

//
// Values used in the IP header Flags field.
//
IP_FLAG_DF = $2; // Don't fragment this
packet.

//
// Supported IP Option Types.
//
// These types define the options which may be used in the OptionsData
field
// of the ip_option_information structure. See RFC 791 for a complete
// description of each.
//
IP_OPT_EOL = 0; // End of list option
IP_OPT_NOP = 1; // No operation
IP_OPT_SECURITY = $82; // Security option
IP_OPT_LSRR = $83; // Loose source route
IP_OPT_SSRR = $89; // Strict source route
IP_OPT_RR = $7; // Record route
IP_OPT_TS = $44; // Timestamp
IP_OPT_SID = $88; // Stream ID (obsolete)

MAX_OPT_SIZE = 40; // Maximum length of IP
options in bytes


Type

TIPAddr=integer; // An IP address.
TIPMask=integer; // An IP subnet mask.
TIP_STATUS=Integer; // Status code returned from IP APIs.

//
// The ip_option_information structure describes the options to be
// included in the header of an IP packet. The TTL, TOS, and Flags
// values are carried in specific fields in the header. The OptionsData
// bytes are carried in the options area following the standard IP
header.
// With the exception of source route options, this data must be in the
// format to be transmitted on the wire as specified in RFC 791. A source
// route option should contain the full route - first hop thru final
// destination - in the route data. The first hop will be pulled out of
the
// data and the option will be reformatted accordingly. Otherwise, the
route
// option should be formatted as specified in RFC 791.
//

POption_Information=^TOption_Information;
TOption_Information=record
Ttl:byte; // Time To Live
Tos:byte; // Type Of Service
Flags:byte; // IP header flags
OptionsSize:byte; // Size in bytes of options
data
OptionsData:pointer; // Pointer to options data
end;

// The icmp_echo_reply structure describes the data returned in response
// to an echo request.
//

Picmp_echo_reply=^Ticmp_echo_reply;
Ticmp_echo_reply=record
Address:TipAddr; // Replying address
Status:integer; // Reply IP_STATUS
RoundTripTime:integer; // RTT in
milliseconds
DataSize:word; // Reply data size in
bytes
Reserved:word; // Reserved for
system use
Data:pointer; // Pointer to the
reply data
Options:Toption_Information; // Reply options
end;

//++
//
// Routine Name:
//
// IcmpCreateFile
//
// Routine Description:
//
// Opens a handle on which ICMP Echo Requests can be issued.
//
// Arguments:
//
// None.
//
// Return Value:
//
// An open file handle or INVALID_HANDLE_VALUE. Extended error
information
// is available by calling GetLastError().
//
//--


function IcmpCreateFile:Thandle; StdCall;
// Routine Name:
//
// IcmpCloseHandle
//
// Routine Description:
//
// Closes a handle opened by ICMPOpenFile.
//
// Arguments:
//
// IcmpHandle - The handle to close.
//
// Return Value:
//
// TRUE if the handle was closed successfully, otherwise FALSE.
Extended
// error information is available by calling GetLastError().
//
//--

function IcmpCloseHandle(H:Thandle):Bool; StdCall;

//
// Routine Name:
//
// IcmpSendEcho
//
// Routine Description:
//
// Sends an ICMP Echo request and returns any replies. The
// call returns when the timeout has expired or the reply buffer
// is filled.
//
// Arguments:
//
// IcmpHandle - An open handle returned by ICMPCreateFile.
//
// DestinationAddress - The destination of the echo request.
//
// RequestData - A buffer containing the data to send in the
// request.
//
// RequestSize - The number of bytes in the request data
buffer.
//
// RequestOptions - Pointer to the IP header options for the
request.
// May be NULL.
//
// ReplyBuffer - A buffer to hold any replies to the
request.
// On return, the buffer will contain an array
of
// ICMP_ECHO_REPLY structures followed by the
// options and data for the replies. The
buffer
// should be large enough to hold at least one
// ICMP_ECHO_REPLY structure plus
// MAX(RequestSize, 8) bytes of data since an
ICMP
// error message contains 8 bytes of data.
//
// ReplySize - The size in bytes of the reply buffer.
//
// Timeout - The time in milliseconds to wait for
replies.
//
// Return Value:
//
// Returns the number of ICMP_ECHO_REPLY structures stored in
ReplyBuffer.
// The status of each reply is contained in the structure. If the
return
// value is zero, extended error information is available via
// GetLastError().
//
//--

Function IcmpSendEcho(IcmpHandle:Thandle;
DestinationAddress:TipAddr;
RequestData:pointer;
RequestSize:word;
RequestOptions:POption_Information;
ReplyBuffer:pointer;
ReplySize:integer;
Timeout:integer):Integer; stdcall;

Implementation

function IcmpCreateFile; external 'Icmp.Dll';
function IcmpCloseHandle; external 'Icmp.Dll';
Function IcmpSendEcho; external 'Icmp.Dll';

end.

--
mike cariotoglou
mi...@REMOVETHIS.singular.gr

Jonathan

unread,
May 18, 1999, 3:00:00 AM5/18/99
to
or look here http://www.djernaes.dk/martin/icmp_info.html

Jonathan


Mike Cariotoglou <mi...@REMOVETHIS.singular.gr> wrote in message
news:MPG.11abfed09...@forums.inprise.com...

> file://++


> //
> // Routine Name:
> //
> // IcmpCreateFile
> //
> // Routine Description:
> //
> // Opens a handle on which ICMP Echo Requests can be issued.
> //
> // Arguments:
> //
> // None.
> //
> // Return Value:
> //
> // An open file handle or INVALID_HANDLE_VALUE. Extended error
> information
> // is available by calling GetLastError().
> //

> file://--


>
>
> function IcmpCreateFile:Thandle; StdCall;
> // Routine Name:
> //
> // IcmpCloseHandle
> //
> // Routine Description:
> //
> // Closes a handle opened by ICMPOpenFile.
> //
> // Arguments:
> //
> // IcmpHandle - The handle to close.
> //
> // Return Value:
> //
> // TRUE if the handle was closed successfully, otherwise FALSE.
> Extended
> // error information is available by calling GetLastError().
> //

> file://--

> file://--

Jeff Overcash (TeamB)

unread,
May 18, 1999, 3:00:00 AM5/18/99
to
Please don't over quote.

Jonathan

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
eh??

Jeff Overcash (TeamB) <over...@onramp.net> wrote in message
news:3741FFB9...@onramp.net...


> Please don't over quote.
>
> Jonathan wrote:
> >

Francois Piette

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
>here is the api of ICMP.DLL , which is what windows uses for the
>implementation of PING. have fun. I know it works, I am using it on a
>watchdog program..


I made a component around this ICMP api. The component is called TPing and
is available freely as part of ICS collection. Download source code
(ICS.ZIP) from http://www.rtfm.be/fpiette/indexuk.htm and look at pingtst
demo program.

Scott Roberts

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
I think Jeff meant that there was no need to include Mike's entire
posting in your reply. You should snip as much as possible from your
reply ... but not too much.

Jonathan wrote in message <7htqk7$dp...@forums.borland.com>...


>eh??
>
>Jeff Overcash (TeamB) <over...@onramp.net> wrote in message
>news:3741FFB9...@onramp.net...
>> Please don't over quote.
>>
>> Jonathan wrote:
>> >

Jonathan

unread,
May 19, 1999, 3:00:00 AM5/19/99
to
arrr.....sorry never thought.

Jonathan

Scott Roberts <sgro...@nospam-ionet.net> wrote in message
news:7huil0$ef...@forums.borland.com...

0 new messages