Logo Search packages:      
Sourcecode: qt4-x11 version File versions

src_network_socket_qnativesocketengine.cpp

//! [0]
QNativeSocketEngine socketLayer;
socketLayer.initialize(QAbstractSocket::TcpSocket, QAbstractSocket::IPv4Protocol);
socketLayer.connectToHost(QHostAddress::LocalHost, 22);
// returns false

socketLayer.waitForWrite();
socketLayer.connectToHost(QHostAddress::LocalHost, 22);
// returns true
//! [0]


//! [1]
QNativeSocketEngine socketLayer;
socketLayer.bind(QHostAddress::Any, 4000);
socketLayer.listen();
if (socketLayer.waitForRead()) {
    int clientSocket = socketLayer.accept();
    // a client is connected
}
//! [1]

Generated by  Doxygen 1.6.0   Back to index