more socket tweaks

pull/1/head
Tom Early 8 years ago
parent 729877c50d
commit fe6512dad0

@ -90,12 +90,12 @@ bool CUDPSocket::open() // returns true on error
int reuse = 1; int reuse = 1;
if (::setsockopt(m_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) == -1) { if (::setsockopt(m_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) == -1) {
printf("Cannot set the UDP socket option, err: %d, %s\n", errno, strerror(errno)); printf("Cannot set the UDP socket (port %u) option, err: %d, %s\n", m_port, errno, strerror(errno));
return true; return true;
} }
if (::bind(m_fd, (sockaddr*)&addr, sizeof(sockaddr_in)) == -1) { if (::bind(m_fd, (sockaddr*)&addr, sizeof(sockaddr_in)) == -1) {
printf("Cannot bind the UDP address, err: %d, %s\n", errno, strerror(errno)); printf("Cannot bind the UDP (port %u) address, err: %d, %s\n", m_port, errno, strerror(errno));
return true; return true;
} }
} }

@ -57,7 +57,6 @@
#include "IRCutils.h" #include "IRCutils.h"
#include "versions.h" #include "versions.h"
#include "g2_typedefs.h" #include "g2_typedefs.h"
#include "aprs.h"
#include "g2_ircddb.h" #include "g2_ircddb.h"

@ -18,6 +18,8 @@
#include <libconfig.h++> #include <libconfig.h++>
#include "aprs.h"
using namespace libconfig; using namespace libconfig;
#define IP_SIZE 15 #define IP_SIZE 15

@ -70,13 +70,13 @@ void CMMDVMModem::Run(const char *cfgfile)
if (Initialize(cfgfile)) if (Initialize(cfgfile))
return; return;
CUDPSocket GatewaySock(G2_INTERNAL_IP, G2_INTERNAL_PORT); CUDPSocket MMDVMSock(MMDVM_IP, MMDVM_PORT);
if (GatewaySock.open()) if (MMDVMSock.open())
return; return;
CUDPSocket MMDVMSock(MMDVM_IP, MMDVM_PORT); CUDPSocket GatewaySock(G2_INTERNAL_IP, G2_INTERNAL_PORT);
if (MMDVMSock.open()) { if (GatewaySock.open()) {
GatewaySock.close(); MMDVMSock.close();
return; return;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.