sslsocket wrong port question

I’m trying to alert my users if the wrong port is being used when connecting a sslsocket. When I purposefully use the incorrect port, I get 22 as the last error code. Is that the correct code to look out for?