title: Sockets Programming with Python: Get the port of a server
body: <p>So as the title suggests is there any way that I can get the port of a website/ip with a socket connection? I assigned <code>socket.gethostbyname()</code> to the simple variable "ip" so that I can print out the result in console but can I do the same with the port? Here is the website that I am using to learn with > <a href="https://docs.python.org/3/library/socket.html" rel="nofollow noreferrer">https://docs.python.org/3/library/socket.html</a> &lt; and what I am wondering is if this is a good source or does anyone know a better one? Thank you much :D</p>