Showing the changes to interface/src/main.cpp (1 of 2 files). Show all
Unified · Split
| @@ -58,7 +58,7 @@ int simulate_on = 1; · 57 unmodified lines | |||
| 58 | 58 | ||
| 59 | const int MAX_PACKET_SIZE = 1500; | 59 | const int MAX_PACKET_SIZE = 1500; |
| 60 | char DOMAIN_HOSTNAME[] = "highfidelity.below92.com"; | 60 | char DOMAIN_HOSTNAME[] = "highfidelity.below92.com"; |
| 61 | char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be re-set by lookup on startup | 61 | char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be used first if not empty string |
| 62 | const int DOMAINSERVER_PORT = 40102; | 62 | const int DOMAINSERVER_PORT = 40102; |
| 63 | UDPSocket agentSocket(AGENT_UDP_PORT); | 63 | UDPSocket 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 hostnames | 931 | // 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 | ||