Commit 08343cb8 authored by jcacerec's avatar jcacerec
Browse files

added DNS Support lookup

parent 9b7c101b
---
1.1
trunk
- (added) Support for RtAudio. Jacktrip can now be used without Jack
- (added) New port to Windows XP and Windows Vista
- (added) Multiclient Server
- (added) DNS Look-up support
---
1.0.5
......
......@@ -39,6 +39,8 @@
#include "jacktrip_globals.h"
#include "JackTrip.h"
#include <QHostInfo>
#include <cstring>
#include <iostream>
#include <cstdlib>
......@@ -90,12 +92,20 @@ UdpDataProtocol::~UdpDataProtocol()
//*******************************************************************************
void UdpDataProtocol::setPeerAddress(const char* peerHostOrIP) throw(std::invalid_argument)
{
mPeerAddress.setAddress(peerHostOrIP);
// Get DNS Address
QHostInfo info = QHostInfo::fromName(peerHostOrIP);
if (!info.addresses().isEmpty()) {
// use the first IP address
mPeerAddress = info.addresses().first();
//cout << "UdpDataProtocol::setPeerAddress IP Address Number: "
// << mPeerAddress.toString().toStdString() << endl;
}
// check if the ip address is valid
if ( mPeerAddress.isNull() ) {
QString error_message = "Incorrect presentation format address\n '";
error_message.append(peerHostOrIP);
error_message.append("' is not a valid IP address");
error_message.append("' is not a valid IP address or Host Name");
//std::cerr << "ERROR: Incorrect presentation format address" << endl;
//std::cerr << "'" << peerHostOrIP <<"' does not seem to be a valid IP address" << endl;
//throw std::invalid_argument("Incorrect presentation format address");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment