Find free port for socket connection on OS X

时间:2017-04-24 17:33:42

标签: objective-c macos networking

I am writting the appliacation that is using client-server communication. I was tried to find the way to discover free socket port on mac and was not able to find one using objc. Is there a way to discover free port on mac using objective-c.

I am aware how to do this in C but I wonder if there is a not C way.

1 个答案:

答案 0 :(得分:0)

您可以制作NSSocketPort,然后解析其addressstruct sockaddr_in的字节数。)