我正在寻找在 iPhone 和服务器之间进行 TCP 数据包传输的“简单”用法。我猜主要是打开套接字,指定端口和 IP,然后按发送。 (这通常是我使用 Python 做的事情)。有人知道快速入门指南或“白痴”类型的教程吗?
NSURL* url = [NSURL urlWithString: @"http://eexample.com/page.php?param=2323"];
NSString* stringForUrlPath = [NSString stringWithContentsOfURL: url
encoding: NSUTF8StringEncoding
error: nil];
// in stringForUrlPath you will hold whatever the server responded you
这是一篇相当不错的文章:iPhone网络编程