always store ports as unsigned short ports

This commit is contained in:
Stephen Birarda 2013-02-18 09:50:15 -08:00
parent c3c0793ddc
commit fd73b8de82
4 changed files with 7 additions and 7 deletions

View file

@ -43,9 +43,9 @@ struct AgentList {
char agentType;
uint32_t ip;
in_addr public_sin_addr;
in_port_t public_port;
unsigned short public_port;
char *private_addr;
in_port_t private_port;
unsigned short private_port;
float x, y, z;
bool active;
timeval time, connectTime;

View file

@ -19,7 +19,7 @@
#include "UDPSocket.h"
#include "Audio.h"
const int AGENT_UDP_PORT = 40103;
const unsigned short AGENT_UDP_PORT = 40103;
int update_agents(char * data, int length);
int add_agent(char * address, unsigned short port, char *private_address, unsigned short private_port, char agentType);

View file

@ -60,7 +60,7 @@ int simulate_on = 1;
const int MAX_PACKET_SIZE = 1500;
char DOMAIN_HOSTNAME[] = "highfidelity.below92.com";
char DOMAIN_IP[100] = ""; // IP Address will be used first if not empty string
char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be used first if not empty string
const int DOMAINSERVER_PORT = 40102;
UDPSocket agentSocket(AGENT_UDP_PORT);
@ -231,7 +231,7 @@ void Timer(int extra)
// Send a message to the domainserver telling it we are ALIVE
//
char output[100];
sprintf(output, "%c %f,%f,%f,%s %hd", 'I', location[0], location[1], location[2], localAddressBuffer, (unsigned short) AGENT_UDP_PORT);
sprintf(output, "%c %f,%f,%f,%s %hd", 'I', location[0], location[1], location[2], localAddressBuffer, AGENT_UDP_PORT);
std::cout << "sending " << output << " to domain server\n";
int packet_size = strlen(output);
agentSocket.send(DOMAIN_IP, DOMAINSERVER_PORT, output, packet_size);

View file

@ -18,7 +18,7 @@
const int MAX_AGENTS = 1000;
const int LOGOFF_CHECK_INTERVAL = 1000;
const int MIXER_LISTEN_PORT = 55443;
const unsigned short MIXER_LISTEN_PORT = 55443;
const int BUFFER_LENGTH_BYTES = 1024;
const int BUFFER_LENGTH_SAMPLES = BUFFER_LENGTH_BYTES / sizeof(int16_t);
@ -229,7 +229,7 @@ void *reportAliveToDS(void *args) {
while (true) {
gettimeofday(&lastSend, NULL);
sprintf(output, "%c %f,%f,%f,54.241.92.53 %hd", 'M', 0.f, 0.f, 0.f, (unsigned short)MIXER_LISTEN_PORT);
sprintf(output, "%c %f,%f,%f,54.241.92.53 %hd", 'M', 0.f, 0.f, 0.f, MIXER_LISTEN_PORT);
int packetSize = strlen(output);
audioSocket.send(DOMAIN_IP, DOMAINSERVER_PORT, output, packetSize);