History

Domain IP is used if static, else looked up.

Philip Rosedale committed 13 years ago

Commit c360fab1 parent 10ff0742 files · +14 −15Browse files

Showing the changes to interface/src/main.cpp (1 of 2 files). Show all

Unified · Split

interface/src/main.cpp+13−14
@@ -58,7 +58,7 @@ int simulate_on = 1; · 57 unmodified lines
58 58
59const int MAX_PACKET_SIZE = 1500;59const int MAX_PACKET_SIZE = 1500;
60char DOMAIN_HOSTNAME[] = "highfidelity.below92.com";60char DOMAIN_HOSTNAME[] = "highfidelity.below92.com";
61char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be re-set by lookup on startup61char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be used first if not empty string
62const int DOMAINSERVER_PORT = 40102;62const int DOMAINSERVER_PORT = 40102;
63UDPSocket agentSocket(AGENT_UDP_PORT);63UDPSocket agentSocket(AGENT_UDP_PORT);
64 64
@@ -929,19 +929,18 @@ int main(int argc, char** argv) · 864 unmodified lines
929 incomingPacket = new char[MAX_PACKET_SIZE];929 incomingPacket = new char[MAX_PACKET_SIZE];
930 930
931 // Lookup the IP address of things we have hostnames931 // Lookup the IP address of things we have hostnames
932 /*932 if (atoi(DOMAIN_IP) == 0) {
933 printf("need to look this one up\n");933 struct hostent* pHostInfo;
934 struct hostent* pHostInfo;934 if ((pHostInfo = gethostbyname(DOMAIN_HOSTNAME)) != NULL) {
935 if ((pHostInfo = gethostbyname(DOMAIN_HOSTNAME)) != NULL) { 935 sockaddr_in tempAddress;
936 sockaddr_in tempAddress;936 memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length);
937 memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length);937 strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr));
938 strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr));938 printf("Domain server %s: %s\n", DOMAIN_HOSTNAME, DOMAIN_IP);
939 printf("Domain server found: %s\n", DOMAIN_IP);939
940 940 } else {
941 } else {941 printf("Failed lookup domainserver\n");
942 printf("Failed lookup domain server\n");942 }
943 }943 } else printf("Using static domainserver IP: %s\n", DOMAIN_IP);
944 */
945 944
946 //std::cout << "Test address: " << inet_ntoa(testAddress.sin_addr) << "\n";945 //std::cout << "Test address: " << inet_ntoa(testAddress.sin_addr) << "\n";
947 946