delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/12/15:43:10

From: Richard Dawe <richdawe AT bigfoot DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: to ping an address via tcp/ip
Date: Sun, 12 Mar 2000 13:01:01 +0000
Organization: Customer of Planet Online
Lines: 53
Message-ID: <38CB950D.8157EE7F@bigfoot.com>
References: <38c8db0f AT grissom>
NNTP-Posting-Host: modem-115.exorex.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg2.svr.pol.co.uk 952888548 31725 62.136.94.115 (12 Mar 2000 19:15:48 GMT)
NNTP-Posting-Date: 12 Mar 2000 19:15:48 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Warp Kez wrote:
> Out of necessity I have to rewrite most of my VB programs in C, but I am
> unfamiliar with the language.
> 
> Is there a web site that specialises in Network programming using DJGPP,
> that could give me an idea on the command structure required to ping and
> then return that machines hostname?

This really depends which operating system you want the program to run
under.

I maintain libsocket:

http://libsocket.tsx.org/

This uses some of Windows's low-level networking interfaces (virtual
device drivers) to provide networking to DOS programs running under
Windows.

You could use the RSXNT/DJ add-on for DJGPP, which allows you to create
Windows programs using DJGPP.

If you want to the program to run under DOS, then you could look at
Watt-32:

http://www.bgnett.no/~giva/

To ping a machine you need to construct an ICMP packet, which means
constructing the IP header yourself using a raw socket. Winsock 1 (well,
Microsoft's implementation) will not allow you to do this. Winsock 2 does,
but you need to run with Administrator priviledges on Windows NT. IIRC
Watt-32 has raw socket support, so you should be able to do this under
DOS.

To return the host name you'll need to do a reverse DNS lookup (numbers to
name(s)), which aren't strictly required by the RFCs. The BSD socket call
for this gethostbyaddr().

I have a bunch of links here that might help you:

http://www.phekda.freeserve.co.uk/richdawe/lsck/lsck_lnk.htm

If you're mainly concerned about Windows, then read the Winsock
Programmer's FAQ (link on the links page above). This is a good read
anyway, for general network programming.

HTH, bye,

-- 
Richard Dawe
richdawe AT bigfoot DOT com ICQ 47595498 http://www.bigfoot.com/~richdawe/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019