I want to establish a tcp connection between iphone and pc. On the PC, QTspServer is up and running (has been tested with another client application).
Here is the connection method that I use on iphone:
- (IBAction)connectToServer:(id)sender {
CFReadStreamRef read = NULL;
CFWriteStreamRef write = NULL;
NSString *host = @"192.168.1.169";
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (CFStringRef)host, 1000, &read, &write);
CFWriteStreamOpen(write);
int k = 0;
}
The server does not respond to the PC. Any help is suitable
By the way: Server is nothing more than QTcpServer with an advanced method incomingConnection. Here is mainthe server side function :
int main(int argc, char **argv)
{
QApplication app(argc, argv);
AbstractServer server;
server.listen(QHostAddress::Any, 1000);
QLabel label("Hello server");
label.setFixedSize(400, 400);
label.show();
return app.exec();
}
source
share