Changeset 31 in pacpussensors for trunk/PacpusSocket


Ignore:
Timestamp:
Jan 17, 2014, 6:18:04 PM (11 years ago)
Author:
phudelai
Message:

ok

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PacpusSocket/PacpusSocket.cpp

    r21 r31  
    9090        {
    9191            if (udpSocket_->bind(QHostAddress::Any, port2bind_, QUdpSocket::DontShareAddress))
    92                 qDebug() << "Socket bound for server on port " << port2bind_;
     92                        qDebug() << "Socket bound for server on port " << port2bind_;
    9393            else
    94                 qWarning() << "Failed to bind socket on port " << port2bind_;
     94                        qWarning() << "Failed to bind socket on port " << port2bind_;
    9595        }
    9696        else if (socketType_ == "client")
    9797        {
    9898          if (udpSocket_->bind(QHostAddress::Any, port2send_ + 1, QUdpSocket::DontShareAddress))
    99                 qDebug() << "Socket bound for client on port " << port2send_ + 1;
     99                        qDebug() << "Socket bound for client on port " << port2send_ + 1;
    100100            else
    101                 qWarning() << "Failed to bind socket" << port2send_ + 1;
     101                        qWarning() << "Failed to bind socket" << port2send_ + 1;
    102102        }
    103103           
     
    113113        {
    114114            if ((sent = udpSocket_->writeDatagram(frame.toLocal8Bit(), address2send_, port2send_)) == -1)
    115                 qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl;
    116             else
    117                 qDebug() << "TO NETWORK:" << address2send_ << port2send_ << frame << "size" << sent;
     115                        qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl;
     116            //else
     117                        //qDebug() << "TO NETWORK:" << address2send_ << port2send_ << frame << "size" << sent;
    118118        }
    119119        else if (socketType_ == "server")
     
    123123                if ((sent = udpSocket_->writeDatagram(frame.toLocal8Bit(), listClients[i]->getAddress(), listClients[i]->getPort())) == -1)
    124124                    qDebug() << "Failed to send the frame: " << listClients[i]->getAddress() << listClients[i]->getPort() << frame << endl;
    125                 else
    126                     qDebug() << "TO NETWORK:" << listClients[i]->getAddress() << listClients[i]->getPort() << frame << "size" << sent;         
     125                //else
     126                    //qDebug() << "TO NETWORK:" << listClients[i]->getAddress() << listClients[i]->getPort() << frame << "size" << sent;       
    127127            }
    128128        }
     
    137137        {
    138138            if ((sent = udpSocket_->writeDatagram(frame, address2send_, port2send_)) == -1)
    139                 qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl;
    140             else
    141                 qDebug() << "TO NETWORK:" << address2send_ << port2send_ << frame << "size" << sent;
     139                        qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl;
     140            //else
     141                        //qDebug() << "TO NETWORK:" << address2send_ << port2send_ << frame << "size" << sent;
    142142        }
    143143        else if (socketType_ == "server")
     
    145145            for (int i = 0; i < listClients.size(); i++)
    146146            {
    147                 if ((sent = udpSocket_->writeDatagram(frame, listClients[i]->getAddress(), listClients[i]->getPort())) == -1)
    148                     qDebug() << "Failed to send the frame: " << listClients[i]->getAddress() << listClients[i]->getPort() << frame << endl;
    149                 else
    150                     qDebug() << "TO NETWORK:" << listClients[i]->getAddress() << listClients[i]->getPort() << frame << "size" << sent;         
     147                        if ((sent = udpSocket_->writeDatagram(frame, listClients[i]->getAddress(), listClients[i]->getPort())) == -1)
     148                                qDebug() << "Failed to send the frame: " << listClients[i]->getAddress() << listClients[i]->getPort() << frame << endl;
     149                        //else
     150                                //qDebug() << "TO NETWORK:" << listClients[i]->getAddress() << listClients[i]->getPort() << frame << "size" << sent;   
    151151            }
    152152        }
Note: See TracChangeset for help on using the changeset viewer.