🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3898

Searching for potential servers

#3898
From: Andrue Cope [TeamB]
Date: Tue, 17 May 2005 14:03
42 lines
2329 bytes
I already have code in place to set up client/server links across our
network and it works well. Unfortunately I now need to be able search
for available servers so that I can get the user to pick one from a
list.

My problem is that I have several hundred potential addresses to
search. I can't go trying to establish a TClientSocket connection to
every possible address because that would take hours. Instead I'm
looking at sending a Ping but to a particular port. I thought I'd found
some code that did exactly that but it seems not:

  saDest.sin_addr.s_addr = *((u_long FAR *) (lpHost->h_addr));
  saDest.sin_family = AF_INET;
  saDest.sin_port = Port;

  // Send ICMP echo request
  SendEchoRequest(rawSocket, &saDest);

  // Use select() to wait for data to be received
  nRet = WaitForEchoReply(rawSocket);
  if (nRet == SOCKET_ERROR)
    return false;

  if (!nRet)
    return false;

..this doesn't seem to care what port number you use.

I suppose in effect I'm looking for some port sniffing code :-/

Alternatively how else would you implement a system where you could
have half a dozen servers scattered across a couple of hundred
addresses? FWIW the servers are being used to remotely access desktop
machines in a very ad-hoc manner. They are brought up/taken down as
needed and rarely stay active for more than a couple of hours.

Basically if 'Jim' has a problem he brings up the server for an hour or
two while 'Bob' investigates.
-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <4289f9bf$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,122cee9b7cf53719,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Searching for potential servers
Newsgroups: borland.public.cppbuilder.internet.socket
User-Agent: XanaNews/1.17.4.1
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <4289f9bf$1@newsgroups.borland.com>
Date: 17 May 2005 07:03:43 -0700
X-Trace: newsgroups.borland.com 1116338623 217.207.223.34 (17 May 2005 07:03:43 -0700)
Lines: 42
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail