Bonjour isn’t pre-installed on windows machines afaik.
That should not matter as developers can package their apps with free Bonjour redistributables under the Apache 2.0 license.
https://developer.apple.com/softwarelicensing/agreements/bonjour.html
Not sure if that would be a problem for ArenaNet as I am not a legal expert, but it seems ok on the surface.
The problem with just using TCP on a user machine to serve out information, without something like Bonjour, is that you do not know for sure if a particular port that you want to use, is available. For example, if I am already running my own web server there would be a conflict with apps such as GWLink that expects port 80 to be free. And not all users are technical enough to reconfigure their own servers and ports.
In case of a TCP connection that would be less of a problem.
First and foreall, nothing should require your port 80 unless you really install a webserver on it (how many users run a webserver on their machine o_o).
Port 80 is a well-known port and should just be used for the HTTP.
You should take a port from the range of 1024-49151. Those are registered ports and chances are, that they are not taken by any other application on a user machine.
Some of them are registered, so just take one from which isn’t listened here:
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
Once a new client tries to establish a new TCP connection to localhost:port the TCP handshake will establish a connection on one of the ephemeral ports anyway.
Bonjour helps the user on the configuration side when running in a network.
A service can put their service information up, and with that comes the IP address etc.
If another device now looks for services within that network, it just has to check the services available via Bonjour.
That will return a list of all sorts of services in that network, from printers to streaming services etc.
Yes GW2 could register a service there aswell, that way a user doesn’t have to configure the IP address etc.
And if the IP address changes, then the user doesn’t have to reconfigure all the data, because once the service starts, it will register with the most recent configuration, which gets deleted everytime the service shuts down.
As I said, this is mostly useful for applications running on other devices, like a secondary computer, a tablet or smartphone within the same network.
If the application is running on the same computer, then localhost or 127.0.0.1 will just do the trick perfectly fine.
The only upside of bonjour in that case would be, that the GW2 client could choose a free port from basically all available ports and register the service on that port.
Bonjour doesn’t seem to offer any help with that task (just took a quick look, and at least the port number must be defined when you register the service, which makes sense).
So in that case, Bonjour doesn’t help you if that port isn’t free. It helps you to configure all devices/service users in case that you have to switch your service port.
But if the only reason to use Bonjour is to make this particular thing of port configuration of a single application which will connect to localhost, then using such a massive system is oversized to say the least.
You know, in that case, a simple .txt file which gets generated once the listening port is established, which includes just the port number would essentially do the same.