iOS:如何获取http连接的源端口 [英] iOS: how to get the http connection's source port
本文介绍了iOS:如何获取http连接的源端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用NSURLRequest和NSURLConnection访问服务器:
I use NSURLRequest and NSURLConnection to access server:
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:self.url];
[request setHTTPMethod:@"PROPFIND"];
[request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
...
NSURLConnection* conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[coon start];
我知道我们需要目的地IP
和目标端口
连接服务器;
I know we need a destination IP
and destination port
to connect server;
问题是:
如何获取和设置我的http连接的源端口
? (只是意味着我需要HTTP连接的本地端口);服务器需要它用于NAT设置。任何建议将不胜感激。
the question is:
how to get&set the source port
of my http connection? (just mean I need the local port of my HTTP connection); server need it for NAT settings. Any suggestion will be greatly appreciated.
谢谢。
推荐答案
,我必须做一些工作来创建我自己的自定义HTTP,然后支持设置HTTP使用的套接字的酸端口。
finally, I had to do some work to create my own custom HTTP, and then support for setting the sour port of the socket the HTTP used.
这篇关于iOS:如何获取http连接的源端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文