Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TIdDNSServer simple example



Permlink Replies: 3 - Last Post: Dec 5, 2017 7:49 AM Last Post By: Antonio Estevez
Mehmet Fide

Posts: 5
Registered: 3/16/00
TIdDNSServer simple example
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 26, 2017 5:36 AM
Hi,

We have a product called gateway that reads smart electricity meters
through RS485 bus and can ship all related info to the customer via
GPRS. Our gateway does that by providing a TCP server service to the
customer. So customers have to connect to the gateway.

Since GSM providers here ask for extra fee for static IP, our gateways
use dynamic IP on the internet side and that makes them unreachable for
the customers because their IPs are changing frequently. Well, there
are services such as www.noip.com or dyn.com but we also don’t want to
depend on them.

So, what I thought that Indy may help here and we can develop a service
for a DNS server that manages each gateways domain name like that:
For example company domain: mycompany.com
gateway1.mycompany.com will be assigned to first gateway and whenever the
gateway address changes on the GPRS side, the gateway updates its IP
through our custom DNS server service.
gateway2.mycompany.com, gateway3.mycompany.com and so on for each
gateway…

For that purpose, I've checked Indy component pallet and found
TIdDNSServer that makes me happy because the name is exactly what I
want :) Delphi now supports Linux that makes me two times happy.

The problem is that I couldn’t find any example or documentation about
TIdDNSServer component, how to use it or does it really suits our
requirements. I’m not an expert at DNS protocol, I only know that DNS
server uses UPD and I need to add Host (A) record.

Thanks for your help and any other ideas.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TIdDNSServer simple example [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 27, 2017 11:03 AM   in response to: Mehmet Fide in response to: Mehmet Fide
Mehmet Fide wrote:

The problem is that I couldn’t find any example or documentation
about TIdDNSServer component, how to use it

That is because there isn't any.

does it really suits our requirements.

Sorry, I can't answer that. I have never used TIdDNSServer before. I
want to say "yes", it supports your requirement, I just don't know HOW
to use it.

--
Remy Lebeau (TeamB)
Justin Case

Posts: 67
Registered: 8/4/13
Re: TIdDNSServer simple example [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 5, 2017 7:13 AM   in response to: Mehmet Fide in response to: Mehmet Fide
Hi Mehmet,

"Mehmet Fide" <off at a dot net> wrote in message
news:949163 at forums dot embarcadero dot com...
Hi,

We have a product called gateway that reads smart electricity meters
through RS485 bus and can ship all related info to the customer via
GPRS. Our gateway does that by providing a TCP server service to the
customer. So customers have to connect to the gateway.

Since GSM providers here ask for extra fee for static IP, our gateways
use dynamic IP on the internet side and that makes them unreachable for
the customers because their IPs are changing frequently.

I think you mean because your IP changes frequently? A customers IP being
changed would not stop them making an outbound connection to your network.

So, what I thought that Indy may help here and we can develop a service
for a DNS server that manages each gateways domain name like that:
For example company domain: mycompany.com
gateway1.mycompany.com will be assigned to first gateway and whenever the
gateway address changes on the GPRS side, the gateway updates its IP
through our custom DNS server service.
gateway2.mycompany.com, gateway3.mycompany.com and so on for each
gateway.

You realise that you will need to run this on an external server that is
already online such as a vps or dedicated server? - which will already have
a static IP address..

For that purpose, I've checked Indy component pallet and found
TIdDNSServer that makes me happy because the name is exactly what I
want :) Delphi now supports Linux that makes me two times happy.

While Remy and the indy pit crew mean well with their offerings,
TIdDNSServer isn't much use to anybody. It supports minimal features, has no
documentation, no support for authoritive name servers (or results) etc.
Even the TIdDNSResolver / Client has no support for authoritive answers. It
just bundles them together and spits them out as one set of answers which IS
usable but isn't ideal.

What you need to do is look at using raw udp / tcp (the dns protocol is the
only one to use both). It can be done with Indy using TIdUDPServer (and
TIdTCPServer) but you need to be good with low level packet data and byte
manipulation etc.

This is a page that will get you started - I stumbled on it purely by
accident but it is a gold mine (you'll need to run it through google
translate): http://www.delphipraxis.net/599692-post5.html
Some of the code you will need is missing though - thats the minimal amount
of code so you'll have to write the rest.

You can also find more information on the packets themselves at
http://www.tcpipguide.com

The problem is that I couldn't find any example or documentation about
TIdDNSServer component, how to use it or does it really suits our
requirements. I'm not an expert at DNS protocol, I only know that DNS
server uses UPD and I need to add Host (A) record.

There are minimal samples for Indy 10 out there. Seems a bit pointless
releasing a socket suite of components with no clues how to use them but
thats how things have gone with Indy. The good old days of Indy 8 had loads
of samples, 9 came with a few (but no TIdDNSServer- which was introduced in
v9) and when 10 came out moons ago it seemed like the pit crew completely
gave up on the idea of samples.

When i created my dns nameserver using the two links above (yes it can be
done in delphi!) i had a lot of trial and error to go through so it would
have been handy if Indy did come with a good component and demo for it.
Antonio Estevez

Posts: 665
Registered: 4/12/00
Re: TIdDNSServer simple example [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 5, 2017 7:49 AM   in response to: Mehmet Fide in response to: Mehmet Fide
El 26/11/2017 a las 14:41, Mehmet Fide escribió:
Hi,

We have a product called gateway that reads smart electricity meters
through RS485 bus and can ship all related info to the customer via
GPRS. Our gateway does that by providing a TCP server service to the
customer. So customers have to connect to the gateway.

Since GSM providers here ask for extra fee for static IP, our gateways
use dynamic IP on the internet side and that makes them unreachable for
the customers because their IPs are changing frequently. Well, there
are services such as www.noip.com or dyn.com but we also don’t want to
depend on them.

Thanks for your help and any other ideas.

You can create a web service on your company server which returns the IP
of the gateway passed as parameter.

First, the customer's application must call that service passing the
gateway name (ex. using a PHP script):
http://www.mycompany.com/services/gateway-ip.php?id=gateway1

Then the customer's application connects to the gateway using the IP
returned by the service.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02