| 67 | 3. Make MapGuide Server listen to IPv6 address |
| 68 | When the service of MapGuide Server starts, it uses following code to listen to the client, site and admin ports: |
| 69 | '''''{{{Server\src\Core\Server.cpp}}}''''' |
| 70 | {{{ |
| 71 | ACE_INET_Addr clientAddr((u_short)pServerManager->GetClientPort)); |
| 72 | ACE_INET_Addr adminAddr((u_short)pServerManager->GetAdminPort()); |
| 73 | ACE_INET_Addr siteAddr((u_short)pServerManager->GetSitePort()); |
| 74 | }}} |
| 75 | But this way it always listens to IPv4 address no matter if IPv6 is available. Then the 3 '''{{{ACE_INET_Addr}}}''' instances need be created by another constructor: |
| 76 | {{{ |
| 77 | ACE_INET_Addr (u_short port_number, |
| 78 | const wchar_t host_name[], |
| 79 | int address_family = AF_UNSPEC); |
| 80 | }}} |
| 81 | |
| 82 | by passing in an IPv6 address as '''{{{host_name}}}''', MapGuide Server can listen to the IPv6 address instead of IPv4 address. |
| 83 | But if the given '''{{{host_name}}}''' is a specific IP Address, the Client (Web Extension, Support Server, Admin etc.) has to connect to the Server through the given IP Address. |
| 84 | E.g. if there is a computer whose IP Addresses are: |
| 85 | |
| 86 | {{{ |
| 87 | IPv4 127.0.0.1 |
| 88 | 192.168.0.10 |
| 89 | IPv6 ::1 |
| 90 | fe80::9c4b:2cb5:5cda:5c3f%11 |
| 91 | }}} |
| 92 | |
| 93 | MapGuide Server should be able to be connected with either '''{{{127.0.0.1}}}''' or '''{{{192.168.0.10}}}''' for IPv4 and either '''{{{::1}}}''' or '''{{{fe80::9c4b:2cb5:5cda:5c3f%11}}}''' for IPv6. But if we pass '''{{{127.0.0.1}}}''' as the '''{{{host_name}}}''', MapGuide Server will NOT listen to '''{{{192.168.0.10}}}'''. The same for IPv6. |
| 94 | The solution is: we don’t pass in a specific IP Address, instead: |
| 95 | * For IPv4, we pass in '''{{{0.0.0.0}}}'''. Then it will listen to all IPv4 addresses. |
| 96 | * For IPv6, we pass in '''{{{::}}}'''. Then it will listen to all IPv6 address. |