How to check a TCP port with Cocoa OSX SDK [closed]

青春壹個敷衍的年華 提交于 2020-01-14 16:44:57

问题


I would like to make a cocoa app that will check if some TCP ports are opened on a server. Return a little red ball if it's closed, or green if it's open...

But I'm little bit confused, what class to use, etc.

Thanks in advance for your help


回答1:


If it is enough just to connect to the the port and close it, the simplest thing is to use the BSD calls:

  • create a socket using socket()
  • connect to the remote port using connect()
  • close the socket using close()


来源:https://stackoverflow.com/questions/7997126/how-to-check-a-tcp-port-with-cocoa-osx-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!