I'm using an old cross platform mobile platform (Rhomobile) which supports an api call to detect if there is an available network connection. The source code is available and I can see when we do a call to detect connection we examine the results of the OS level system call to make a socket connection for a given url and port. This was working fine previously as our endpoint was http. We have now migrated this to https and are seeing some strange results. Call made will be
struct addrinfo hints, *result = NULL, *ptr = NULL;
int sockfd = -1;
memset(&hints,0,sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
char szPortAsString[5 + 1];
snprintf(szPortAsString,5,"%d",m_iPort);
char* szHost = new char[m_szHost.length() + 1];
memset(szHost, 0, m_szHost.length() + 1);
strcpy(szHost, m_szHost.c_str());
int iResult = getaddrinfo(szHost, szPortAsString, &hints, &result);
...
sockfd = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
...
connect(sockfd, ptr->ai_addr, ptr->ai_addrlen);
and the port will be 443. What I was unclear about whether the connection will be accepted (we don't need to pass any data) across to an https endpoint which requires a client certificate to send/receive data.
Code can be found here: https://github.com/rhomobile/rhodes/blob/3f5cf6ffa90cf8c648ac19c954932d101fc56b42/lib/commonAPI/coreapi/ext/platform/android/jni/NetworkDetect.cpp