Lcf.vs
Lcf.vs

Reputation: 1842

How to call a local host, by socket... rather than by IP

Actually I make my first steps on sockets, with PHP, locally.

In my hosts, I have a virtual domain named chat.dev.com.

I have seen a lot of examples by IP... but is it possible to call a specific local subdomain, please, rather than my 127.0.0.1?

Upvotes: 0

Views: 350

Answers (1)

Björn Fyrvall
Björn Fyrvall

Reputation: 241

Sockets are identified by a combination of an IP address and a port. In order to try to connect to a DNS, as you seem to imply, you first need to make a DNS lookup for that specific host, get its associated IP address and then connect.

Php has a function for this, please look at http://php.net/manual/en/function.dns-get-record.php

Upvotes: 1

Related Questions