I am working on an application that uses AsyncSocket
.
Is there a way to check if a specific port is being blocked by a firewall?
I am working on an application that uses AsyncSocket
.
Is there a way to check if a specific port is being blocked by a firewall?
Usually you won't be able to know if the port is blocked unless you try to communicate from that port and get a response, as far as I know at least. You can determine if that port is in use however. This method is used in GCDAsyncSocket to determine such a case.
NSError *error = nil;
if (![socket bindToPort:port error:&error])
{
[self logError:[NSString stringWithFormat:@"Error binding port: %@", error)]];
return;
}
Networking is very much a hit and hope approach a lot of the time.