Hello friends I'm Parwase and this is our third video in Python socket
so in the previous video we had a simple example of how you can get host name and the
IP address of your local machine so this code was from the previous video that we
have get the host name and also the IP address of our our
local machine so this video I want to show you that how you can get a remote
machine IP address or we can tell that how you can get the IP address of a
website so now let's get started and I've created a new Python file and so in
here okay so the first thing I need I need to import socket like this and now
let me create a main method in here so the main okay now let me write remote host sorry remote host and now in
you you need to write a website for example a website name now this is my website and let me just copy this you can see that I have a lot of videos a lot of source code in here
and articles about programming you can check this I have added the link to the
video description so now let me just copy this okay now after this let me create a
try and first let me print IP address off remote host
plus is and now is and now you can write and you can get the IP others
So socket. . So my computer is a little slow, I don't know why
So get host by name. And in here you need to add your this remote host Like this and in the except we need to socket
error as e and we need to print the error print error
format e so now this is my complete code and let me just in here I'll let me
if underscore name underscore and there's underscore main and you can call your
main in here so now this is our code we have imported
the socket and this is our for example our website name and in here we are going to
get our this I the IP address of our this website or remote host and you can get by using
get host by name like this so now if I run this and let me just run this and now you can see that this is the IP address of code loop so let me just change this to Python and if I run
this and now you can see that this is the IP others of Python.org so like
this you can get the remote machine IP address and also you can run this
through terminal let me just show you open your terminal and in here you can
write Python remote machine dot pi so now so now you can
see that the result is the same thank you guys I will add the source code to the
video description to the my this website and if you have any question please
let me know and for the further videos please subscribe to my channel and also
share and like the videos