My Android application needs to use an IP address/port to connect to a server. How to know (by code) if the port is already bound or not?
我的Android应用程序需要使用IP地址/端口连接到服务器。如何知道(通过代码)端口是否已被绑定?
1 个解决方案
#1
0
By far the easiest way is to attempt the bind and check the error return (if it succeeded, then it wasn't previously bound).
到目前为止,最简单的方法是尝试绑定并检查错误返回(如果成功,则之前没有绑定)。
#1
0
By far the easiest way is to attempt the bind and check the error return (if it succeeded, then it wasn't previously bound).
到目前为止,最简单的方法是尝试绑定并检查错误返回(如果成功,则之前没有绑定)。