I had the same problem the question is that you only need to check one port or many ports
If you need to check only one or several usage links, if it works, then its free (and don't forget to free the socket)
,
system ('netstat -tulpn') /
": {yourport}"
, , ,