Skip to content

Commit

Permalink
isolating Qt IPv6 stuff because combined mode does not work well.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannagle committed Dec 9, 2015
1 parent bd270ee commit 38d83a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ int main(int argc, char *argv[])

if(tcp) {
QTcpSocket sock;
sock.bind(QHostAddress::Any, bind);
sock.bind(QHostAddress::AnyIPv4, bind);
sock.connectToHost(addy, port);
sock.waitForConnected(1000);
if(sock.state() == QAbstractSocket::ConnectedState)
Expand Down Expand Up @@ -382,7 +382,7 @@ int main(int argc, char *argv[])

} else {
QUdpSocket sock;
if(!sock.bind(QHostAddress::Any, bind)) {
if(!sock.bind(QHostAddress::AnyIPv4, bind)) {
OUTIF() << "Error: Could not bind to " << bind;

OUTPUT();
Expand Down
4 changes: 2 additions & 2 deletions src/packetnetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void PacketNetwork::init()

int udpPort = settings.value("udpPort", 55056).toInt();

bool bindResult = udpSocket->bind(QHostAddress::Any, udpPort);
bool bindResult = udpSocket->bind(QHostAddress::AnyIPv4, udpPort);

if(udpPort < 1024 && !bindResult) {

Expand All @@ -102,7 +102,7 @@ void PacketNetwork::init()

int tcpPort = settings.value("tcpPort", 55056).toInt();

qDebug() << __FILE__ << "/" <<__LINE__ << "tcpServer bind: " << listen(QHostAddress::Any, tcpPort);
qDebug() << __FILE__ << "/" <<__LINE__ << "tcpServer bind: " << listen(QHostAddress::AnyIPv4, tcpPort);


if(tcpPort < 1024 && getTCPPort() == 0) {
Expand Down
6 changes: 2 additions & 4 deletions src/tcpthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ void TCPThread::run()
QDEBUG() << "We are threaded sending!";
clientConnection = new QTcpSocket(this);

QHostAddress address;
address.setAddress(sendPacket.toIP);

sendPacket.fromIP = "You";
sendPacket.timestamp = QDateTime::currentDateTime();
sendPacket.name = sendPacket.timestamp.toString(DATETIMEFORMAT);
Expand All @@ -114,7 +111,7 @@ void TCPThread::run()
}


clientConnection->connectToHost(address, sendPacket.port);
clientConnection->connectToHost(sendPacket.toIP, sendPacket.port, QIODevice::ReadWrite, QAbstractSocket::IPv4Protocol);
clientConnection->waitForConnected(5000);


Expand Down Expand Up @@ -174,6 +171,7 @@ void TCPThread::run()
tcpRCVPacket.name = QDateTime::currentDateTime().toString(DATETIMEFORMAT);
tcpRCVPacket.tcpOrUdp = "TCP";
tcpRCVPacket.fromIP = clientConnection->peerAddress().toString();
QDEBUGVAR(tcpRCVPacket.fromIP);
tcpRCVPacket.toIP = "You";
tcpRCVPacket.port = sendPacket.fromPort;
tcpRCVPacket.fromPort = clientConnection->peerPort();
Expand Down

0 comments on commit 38d83a8

Please sign in to comment.