Search code examples
cwinsockwinsock2

WSAConnect - the remote server responds on both port 80 and 443


I use WSAConnect to connect to a server whose site has the prefix http: \ That is, it seems like the remote server should connect only on port 80. But, in fact, I see that for some pages of this http site - WSAConnect completes successfully on port 443.

Is it okay? Is this allowed?


Solution

  • WSAConnect is for low-level socket communication, for example low-level TCP/IP sockets.

    Web servers use HTTP for communication with clients, such as browsers. HTTP is an application protocol on top of TCP/IP.

    By default web servers use port 80 for plain HTTP communication. Webservers can also support HTTP over a secure connection (HTTPS). The default port for this is 443.

    So it is perfectly fine for a web server to be reachable on port 80 and 443.

    In general, a single server can be reachable on any number of ports. Different ports are used for different protocols.