What's the whole point of “localhost”, hosts and ports at all?












55















I'm totally new to this web development stuff. So I see things like "localhost" all the time and ask myself: What's that?



I feel to know what a "host" actually is. Something that executes something. So my mac is the host for everything that runs on it. So "localhost" is actually just my mac? Can I have also other hosts? like "otherhost" or "betterhost"?



So when I write in my browser: http://localhost:80/mysite/index.php, this "localhost" thing tells the browser to look on my machine for that stuff rather than online?



Maybe someone can clear this up a little bit :-)










share|improve this question



























    55















    I'm totally new to this web development stuff. So I see things like "localhost" all the time and ask myself: What's that?



    I feel to know what a "host" actually is. Something that executes something. So my mac is the host for everything that runs on it. So "localhost" is actually just my mac? Can I have also other hosts? like "otherhost" or "betterhost"?



    So when I write in my browser: http://localhost:80/mysite/index.php, this "localhost" thing tells the browser to look on my machine for that stuff rather than online?



    Maybe someone can clear this up a little bit :-)










    share|improve this question

























      55












      55








      55


      21






      I'm totally new to this web development stuff. So I see things like "localhost" all the time and ask myself: What's that?



      I feel to know what a "host" actually is. Something that executes something. So my mac is the host for everything that runs on it. So "localhost" is actually just my mac? Can I have also other hosts? like "otherhost" or "betterhost"?



      So when I write in my browser: http://localhost:80/mysite/index.php, this "localhost" thing tells the browser to look on my machine for that stuff rather than online?



      Maybe someone can clear this up a little bit :-)










      share|improve this question














      I'm totally new to this web development stuff. So I see things like "localhost" all the time and ask myself: What's that?



      I feel to know what a "host" actually is. Something that executes something. So my mac is the host for everything that runs on it. So "localhost" is actually just my mac? Can I have also other hosts? like "otherhost" or "betterhost"?



      So when I write in my browser: http://localhost:80/mysite/index.php, this "localhost" thing tells the browser to look on my machine for that stuff rather than online?



      Maybe someone can clear this up a little bit :-)







      localhost






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 22 '09 at 12:48









      openfrogopenfrog

      17.4k57203347




      17.4k57203347
























          10 Answers
          10






          active

          oldest

          votes


















          40














          In computer networking, localhost (meaning "this computer") is the standard hostname given to the address of the loopback network interface.



          Localhost always translates to the loopback IP address 127.0.0.1 in IPv4.



          It is also used instead of the hostname of a computer. For example, directing a web browser installed on a system running an HTTP server to http://localhost will display the home page of the local web site.



          Source: Wikipedia - Localhost.





          The :80 part is the TCP port. You can consider these ports as communications endpoints on a particular IP address (in the case of localhost - 127.0.0.1). The IANA is responsible for maintaining the official assignments of standard port numbers for specific services. Port 80 happens to be the standard port for HTTP.






          share|improve this answer





















          • 3





            +1. Good explanation. I particularly like the way that SO has turned localhost into a link that will resolve to each reader's own computer :-)

            – paxdiablo
            Dec 22 '09 at 13:15











          • Are there any other good ports on which to host a local website, i.e. I've already got one running on :80

            – Thomas
            Oct 5 '15 at 15:24











          • @thomas you can do localhost:8087 in your browser to get port 8087. There are no "good ports" except the ones your browser automatically connects to

            – Anonymous Penguin
            Dec 25 '15 at 20:05



















          14














          " In computer networking, a network host, Internet host, host, or Internet node is a computer connected to the Internet - or more generically - to any type of data network. A network host can host information resources as well as application software for providing network services. "-Wikipedia



          Local host is a special name given to the local machine or that you are working on, ussually its IP Address is 127.0.0.1. However you can define it to be anything.



          There are multiple Network services running on each host for example Apache/IIS( Http Web Server),Mail Clients, FTP clients etc. Each service has a specific port associated with it. You can think of it as this.



          In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






          share|improve this answer































            5














            Everyone seems to focus on the host part of your questions. Ports are used to be able to run several servers (for example for different purposes such as file sharing, web serving, printing, etc) from the same machine (one single IP address).






            share|improve this answer































              3














              Localhost generally refers to the machine you're looking at. On most machines localhost resolves to the IP address 127.0.0.1 which is the loopback address.






              share|improve this answer































                3














                Yes, localhost just means that you are talking to the webserver om the same machine that you are currently using.



                Other servers are contacted through either their IP-address or a given name.






                share|improve this answer































                  1














                  Well, others have given a good definition of 'localhost'.



                  It is kind of a defacto for the text representation of the local IP 127.0.0.1.



                  You can have 'betterhost', 'otherhost', 'someotherhost' if you use a DNS server that can translate it to working IP addresses, OR by modifying the host file. But that's another topic for another day or better day. :P






                  share|improve this answer































                    1














                    Regarding you question about betterhost and such, see host; basically every IP address is a host.



                    I suggest you start reading-up from host and only than go on to localhost (which is a type of host)






                    share|improve this answer































                      1














                      I heard a good description (parable) which illustrates ports as different delivery points for a large building, e.g. Post office for letters and small parcels, Goods In for large deliveries / pallets, Doors for people.






                      share|improve this answer































                        1














                        Some databases are designed to communicate over the web using ports assigned by the Internet Assigned Number Authority (IANA) and when run on individual PC use the ports with localhost. Some common databases with their default ports (the defualts can usually be overridden):



                        Port Database



                        1433 Microsoft SQL Server
                        https://support.microsoft.com/en-us/kb/287932



                        3306 MySQL
                        https://dev.mysql.com/doc/refman/4.1/en/connecting.html



                        5432 PostgreSQL



                        1527 Apache Derby (database)



                        Some web servers and databases are paired together such as Apache/MySQL (as in LAMP or XXAMP) or MS Internet Information Server (IIS)/MS SQL Server (IIS/SQL Server) in which case you have to be concerned with both the port of the database and the web server -- a common example of this is WordPress which uses Apache/MySQL.






                        share|improve this answer































                          0














                          Port: In simple language, "Port" is a number used by a particular software to identify its data coming from internet.



                          Each software, like Skype, Chrome, Youtube has its own port number and that's how they know which internet data is for itself.



                          Socket: "IP address and Port " together is called "Socket". It is used by another computer to send data to one particular computer's particular software.



                          IP address is used to identify the computer and Port is to identify the software such as IE, Chrome, Skype etc.



                          In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






                          share|improve this answer

























                            Your Answer






                            StackExchange.ifUsing("editor", function () {
                            StackExchange.using("externalEditor", function () {
                            StackExchange.using("snippets", function () {
                            StackExchange.snippets.init();
                            });
                            });
                            }, "code-snippets");

                            StackExchange.ready(function() {
                            var channelOptions = {
                            tags: "".split(" "),
                            id: "1"
                            };
                            initTagRenderer("".split(" "), "".split(" "), channelOptions);

                            StackExchange.using("externalEditor", function() {
                            // Have to fire editor after snippets, if snippets enabled
                            if (StackExchange.settings.snippets.snippetsEnabled) {
                            StackExchange.using("snippets", function() {
                            createEditor();
                            });
                            }
                            else {
                            createEditor();
                            }
                            });

                            function createEditor() {
                            StackExchange.prepareEditor({
                            heartbeatType: 'answer',
                            autoActivateHeartbeat: false,
                            convertImagesToLinks: true,
                            noModals: true,
                            showLowRepImageUploadWarning: true,
                            reputationToPostImages: 10,
                            bindNavPrevention: true,
                            postfix: "",
                            imageUploader: {
                            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                            allowUrls: true
                            },
                            onDemand: true,
                            discardSelector: ".discard-answer"
                            ,immediatelyShowMarkdownHelp:true
                            });


                            }
                            });














                            draft saved

                            draft discarded


















                            StackExchange.ready(
                            function () {
                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1946193%2fwhats-the-whole-point-of-localhost-hosts-and-ports-at-all%23new-answer', 'question_page');
                            }
                            );

                            Post as a guest















                            Required, but never shown

























                            10 Answers
                            10






                            active

                            oldest

                            votes








                            10 Answers
                            10






                            active

                            oldest

                            votes









                            active

                            oldest

                            votes






                            active

                            oldest

                            votes









                            40














                            In computer networking, localhost (meaning "this computer") is the standard hostname given to the address of the loopback network interface.



                            Localhost always translates to the loopback IP address 127.0.0.1 in IPv4.



                            It is also used instead of the hostname of a computer. For example, directing a web browser installed on a system running an HTTP server to http://localhost will display the home page of the local web site.



                            Source: Wikipedia - Localhost.





                            The :80 part is the TCP port. You can consider these ports as communications endpoints on a particular IP address (in the case of localhost - 127.0.0.1). The IANA is responsible for maintaining the official assignments of standard port numbers for specific services. Port 80 happens to be the standard port for HTTP.






                            share|improve this answer





















                            • 3





                              +1. Good explanation. I particularly like the way that SO has turned localhost into a link that will resolve to each reader's own computer :-)

                              – paxdiablo
                              Dec 22 '09 at 13:15











                            • Are there any other good ports on which to host a local website, i.e. I've already got one running on :80

                              – Thomas
                              Oct 5 '15 at 15:24











                            • @thomas you can do localhost:8087 in your browser to get port 8087. There are no "good ports" except the ones your browser automatically connects to

                              – Anonymous Penguin
                              Dec 25 '15 at 20:05
















                            40














                            In computer networking, localhost (meaning "this computer") is the standard hostname given to the address of the loopback network interface.



                            Localhost always translates to the loopback IP address 127.0.0.1 in IPv4.



                            It is also used instead of the hostname of a computer. For example, directing a web browser installed on a system running an HTTP server to http://localhost will display the home page of the local web site.



                            Source: Wikipedia - Localhost.





                            The :80 part is the TCP port. You can consider these ports as communications endpoints on a particular IP address (in the case of localhost - 127.0.0.1). The IANA is responsible for maintaining the official assignments of standard port numbers for specific services. Port 80 happens to be the standard port for HTTP.






                            share|improve this answer





















                            • 3





                              +1. Good explanation. I particularly like the way that SO has turned localhost into a link that will resolve to each reader's own computer :-)

                              – paxdiablo
                              Dec 22 '09 at 13:15











                            • Are there any other good ports on which to host a local website, i.e. I've already got one running on :80

                              – Thomas
                              Oct 5 '15 at 15:24











                            • @thomas you can do localhost:8087 in your browser to get port 8087. There are no "good ports" except the ones your browser automatically connects to

                              – Anonymous Penguin
                              Dec 25 '15 at 20:05














                            40












                            40








                            40







                            In computer networking, localhost (meaning "this computer") is the standard hostname given to the address of the loopback network interface.



                            Localhost always translates to the loopback IP address 127.0.0.1 in IPv4.



                            It is also used instead of the hostname of a computer. For example, directing a web browser installed on a system running an HTTP server to http://localhost will display the home page of the local web site.



                            Source: Wikipedia - Localhost.





                            The :80 part is the TCP port. You can consider these ports as communications endpoints on a particular IP address (in the case of localhost - 127.0.0.1). The IANA is responsible for maintaining the official assignments of standard port numbers for specific services. Port 80 happens to be the standard port for HTTP.






                            share|improve this answer















                            In computer networking, localhost (meaning "this computer") is the standard hostname given to the address of the loopback network interface.



                            Localhost always translates to the loopback IP address 127.0.0.1 in IPv4.



                            It is also used instead of the hostname of a computer. For example, directing a web browser installed on a system running an HTTP server to http://localhost will display the home page of the local web site.



                            Source: Wikipedia - Localhost.





                            The :80 part is the TCP port. You can consider these ports as communications endpoints on a particular IP address (in the case of localhost - 127.0.0.1). The IANA is responsible for maintaining the official assignments of standard port numbers for specific services. Port 80 happens to be the standard port for HTTP.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Dec 22 '09 at 12:57

























                            answered Dec 22 '09 at 12:50









                            Daniel VassalloDaniel Vassallo

                            267k59444405




                            267k59444405








                            • 3





                              +1. Good explanation. I particularly like the way that SO has turned localhost into a link that will resolve to each reader's own computer :-)

                              – paxdiablo
                              Dec 22 '09 at 13:15











                            • Are there any other good ports on which to host a local website, i.e. I've already got one running on :80

                              – Thomas
                              Oct 5 '15 at 15:24











                            • @thomas you can do localhost:8087 in your browser to get port 8087. There are no "good ports" except the ones your browser automatically connects to

                              – Anonymous Penguin
                              Dec 25 '15 at 20:05














                            • 3





                              +1. Good explanation. I particularly like the way that SO has turned localhost into a link that will resolve to each reader's own computer :-)

                              – paxdiablo
                              Dec 22 '09 at 13:15











                            • Are there any other good ports on which to host a local website, i.e. I've already got one running on :80

                              – Thomas
                              Oct 5 '15 at 15:24











                            • @thomas you can do localhost:8087 in your browser to get port 8087. There are no "good ports" except the ones your browser automatically connects to

                              – Anonymous Penguin
                              Dec 25 '15 at 20:05








                            3




                            3





                            +1. Good explanation. I particularly like the way that SO has turned localhost into a link that will resolve to each reader's own computer :-)

                            – paxdiablo
                            Dec 22 '09 at 13:15





                            +1. Good explanation. I particularly like the way that SO has turned localhost into a link that will resolve to each reader's own computer :-)

                            – paxdiablo
                            Dec 22 '09 at 13:15













                            Are there any other good ports on which to host a local website, i.e. I've already got one running on :80

                            – Thomas
                            Oct 5 '15 at 15:24





                            Are there any other good ports on which to host a local website, i.e. I've already got one running on :80

                            – Thomas
                            Oct 5 '15 at 15:24













                            @thomas you can do localhost:8087 in your browser to get port 8087. There are no "good ports" except the ones your browser automatically connects to

                            – Anonymous Penguin
                            Dec 25 '15 at 20:05





                            @thomas you can do localhost:8087 in your browser to get port 8087. There are no "good ports" except the ones your browser automatically connects to

                            – Anonymous Penguin
                            Dec 25 '15 at 20:05













                            14














                            " In computer networking, a network host, Internet host, host, or Internet node is a computer connected to the Internet - or more generically - to any type of data network. A network host can host information resources as well as application software for providing network services. "-Wikipedia



                            Local host is a special name given to the local machine or that you are working on, ussually its IP Address is 127.0.0.1. However you can define it to be anything.



                            There are multiple Network services running on each host for example Apache/IIS( Http Web Server),Mail Clients, FTP clients etc. Each service has a specific port associated with it. You can think of it as this.



                            In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






                            share|improve this answer




























                              14














                              " In computer networking, a network host, Internet host, host, or Internet node is a computer connected to the Internet - or more generically - to any type of data network. A network host can host information resources as well as application software for providing network services. "-Wikipedia



                              Local host is a special name given to the local machine or that you are working on, ussually its IP Address is 127.0.0.1. However you can define it to be anything.



                              There are multiple Network services running on each host for example Apache/IIS( Http Web Server),Mail Clients, FTP clients etc. Each service has a specific port associated with it. You can think of it as this.



                              In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






                              share|improve this answer


























                                14












                                14








                                14







                                " In computer networking, a network host, Internet host, host, or Internet node is a computer connected to the Internet - or more generically - to any type of data network. A network host can host information resources as well as application software for providing network services. "-Wikipedia



                                Local host is a special name given to the local machine or that you are working on, ussually its IP Address is 127.0.0.1. However you can define it to be anything.



                                There are multiple Network services running on each host for example Apache/IIS( Http Web Server),Mail Clients, FTP clients etc. Each service has a specific port associated with it. You can think of it as this.



                                In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






                                share|improve this answer













                                " In computer networking, a network host, Internet host, host, or Internet node is a computer connected to the Internet - or more generically - to any type of data network. A network host can host information resources as well as application software for providing network services. "-Wikipedia



                                Local host is a special name given to the local machine or that you are working on, ussually its IP Address is 127.0.0.1. However you can define it to be anything.



                                There are multiple Network services running on each host for example Apache/IIS( Http Web Server),Mail Clients, FTP clients etc. Each service has a specific port associated with it. You can think of it as this.



                                In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Dec 22 '09 at 15:02









                                anijhawanijhaw

                                4,57332735




                                4,57332735























                                    5














                                    Everyone seems to focus on the host part of your questions. Ports are used to be able to run several servers (for example for different purposes such as file sharing, web serving, printing, etc) from the same machine (one single IP address).






                                    share|improve this answer




























                                      5














                                      Everyone seems to focus on the host part of your questions. Ports are used to be able to run several servers (for example for different purposes such as file sharing, web serving, printing, etc) from the same machine (one single IP address).






                                      share|improve this answer


























                                        5












                                        5








                                        5







                                        Everyone seems to focus on the host part of your questions. Ports are used to be able to run several servers (for example for different purposes such as file sharing, web serving, printing, etc) from the same machine (one single IP address).






                                        share|improve this answer













                                        Everyone seems to focus on the host part of your questions. Ports are used to be able to run several servers (for example for different purposes such as file sharing, web serving, printing, etc) from the same machine (one single IP address).







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Dec 22 '09 at 13:01









                                        e8johane8johan

                                        2,6281214




                                        2,6281214























                                            3














                                            Localhost generally refers to the machine you're looking at. On most machines localhost resolves to the IP address 127.0.0.1 which is the loopback address.






                                            share|improve this answer




























                                              3














                                              Localhost generally refers to the machine you're looking at. On most machines localhost resolves to the IP address 127.0.0.1 which is the loopback address.






                                              share|improve this answer


























                                                3












                                                3








                                                3







                                                Localhost generally refers to the machine you're looking at. On most machines localhost resolves to the IP address 127.0.0.1 which is the loopback address.






                                                share|improve this answer













                                                Localhost generally refers to the machine you're looking at. On most machines localhost resolves to the IP address 127.0.0.1 which is the loopback address.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Dec 22 '09 at 12:51









                                                Jason PunyonJason Punyon

                                                32k988113




                                                32k988113























                                                    3














                                                    Yes, localhost just means that you are talking to the webserver om the same machine that you are currently using.



                                                    Other servers are contacted through either their IP-address or a given name.






                                                    share|improve this answer




























                                                      3














                                                      Yes, localhost just means that you are talking to the webserver om the same machine that you are currently using.



                                                      Other servers are contacted through either their IP-address or a given name.






                                                      share|improve this answer


























                                                        3












                                                        3








                                                        3







                                                        Yes, localhost just means that you are talking to the webserver om the same machine that you are currently using.



                                                        Other servers are contacted through either their IP-address or a given name.






                                                        share|improve this answer













                                                        Yes, localhost just means that you are talking to the webserver om the same machine that you are currently using.



                                                        Other servers are contacted through either their IP-address or a given name.







                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered Dec 22 '09 at 12:53









                                                        erikricerikric

                                                        1,77072334




                                                        1,77072334























                                                            1














                                                            Well, others have given a good definition of 'localhost'.



                                                            It is kind of a defacto for the text representation of the local IP 127.0.0.1.



                                                            You can have 'betterhost', 'otherhost', 'someotherhost' if you use a DNS server that can translate it to working IP addresses, OR by modifying the host file. But that's another topic for another day or better day. :P






                                                            share|improve this answer




























                                                              1














                                                              Well, others have given a good definition of 'localhost'.



                                                              It is kind of a defacto for the text representation of the local IP 127.0.0.1.



                                                              You can have 'betterhost', 'otherhost', 'someotherhost' if you use a DNS server that can translate it to working IP addresses, OR by modifying the host file. But that's another topic for another day or better day. :P






                                                              share|improve this answer


























                                                                1












                                                                1








                                                                1







                                                                Well, others have given a good definition of 'localhost'.



                                                                It is kind of a defacto for the text representation of the local IP 127.0.0.1.



                                                                You can have 'betterhost', 'otherhost', 'someotherhost' if you use a DNS server that can translate it to working IP addresses, OR by modifying the host file. But that's another topic for another day or better day. :P






                                                                share|improve this answer













                                                                Well, others have given a good definition of 'localhost'.



                                                                It is kind of a defacto for the text representation of the local IP 127.0.0.1.



                                                                You can have 'betterhost', 'otherhost', 'someotherhost' if you use a DNS server that can translate it to working IP addresses, OR by modifying the host file. But that's another topic for another day or better day. :P







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered Dec 22 '09 at 12:56









                                                                o.k.wo.k.w

                                                                21k55358




                                                                21k55358























                                                                    1














                                                                    Regarding you question about betterhost and such, see host; basically every IP address is a host.



                                                                    I suggest you start reading-up from host and only than go on to localhost (which is a type of host)






                                                                    share|improve this answer




























                                                                      1














                                                                      Regarding you question about betterhost and such, see host; basically every IP address is a host.



                                                                      I suggest you start reading-up from host and only than go on to localhost (which is a type of host)






                                                                      share|improve this answer


























                                                                        1












                                                                        1








                                                                        1







                                                                        Regarding you question about betterhost and such, see host; basically every IP address is a host.



                                                                        I suggest you start reading-up from host and only than go on to localhost (which is a type of host)






                                                                        share|improve this answer













                                                                        Regarding you question about betterhost and such, see host; basically every IP address is a host.



                                                                        I suggest you start reading-up from host and only than go on to localhost (which is a type of host)







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered Dec 22 '09 at 12:57









                                                                        DrorDror

                                                                        6,60913240




                                                                        6,60913240























                                                                            1














                                                                            I heard a good description (parable) which illustrates ports as different delivery points for a large building, e.g. Post office for letters and small parcels, Goods In for large deliveries / pallets, Doors for people.






                                                                            share|improve this answer




























                                                                              1














                                                                              I heard a good description (parable) which illustrates ports as different delivery points for a large building, e.g. Post office for letters and small parcels, Goods In for large deliveries / pallets, Doors for people.






                                                                              share|improve this answer


























                                                                                1












                                                                                1








                                                                                1







                                                                                I heard a good description (parable) which illustrates ports as different delivery points for a large building, e.g. Post office for letters and small parcels, Goods In for large deliveries / pallets, Doors for people.






                                                                                share|improve this answer













                                                                                I heard a good description (parable) which illustrates ports as different delivery points for a large building, e.g. Post office for letters and small parcels, Goods In for large deliveries / pallets, Doors for people.







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered Dec 22 '09 at 14:07









                                                                                stjohnroestjohnroe

                                                                                2,77812127




                                                                                2,77812127























                                                                                    1














                                                                                    Some databases are designed to communicate over the web using ports assigned by the Internet Assigned Number Authority (IANA) and when run on individual PC use the ports with localhost. Some common databases with their default ports (the defualts can usually be overridden):



                                                                                    Port Database



                                                                                    1433 Microsoft SQL Server
                                                                                    https://support.microsoft.com/en-us/kb/287932



                                                                                    3306 MySQL
                                                                                    https://dev.mysql.com/doc/refman/4.1/en/connecting.html



                                                                                    5432 PostgreSQL



                                                                                    1527 Apache Derby (database)



                                                                                    Some web servers and databases are paired together such as Apache/MySQL (as in LAMP or XXAMP) or MS Internet Information Server (IIS)/MS SQL Server (IIS/SQL Server) in which case you have to be concerned with both the port of the database and the web server -- a common example of this is WordPress which uses Apache/MySQL.






                                                                                    share|improve this answer




























                                                                                      1














                                                                                      Some databases are designed to communicate over the web using ports assigned by the Internet Assigned Number Authority (IANA) and when run on individual PC use the ports with localhost. Some common databases with their default ports (the defualts can usually be overridden):



                                                                                      Port Database



                                                                                      1433 Microsoft SQL Server
                                                                                      https://support.microsoft.com/en-us/kb/287932



                                                                                      3306 MySQL
                                                                                      https://dev.mysql.com/doc/refman/4.1/en/connecting.html



                                                                                      5432 PostgreSQL



                                                                                      1527 Apache Derby (database)



                                                                                      Some web servers and databases are paired together such as Apache/MySQL (as in LAMP or XXAMP) or MS Internet Information Server (IIS)/MS SQL Server (IIS/SQL Server) in which case you have to be concerned with both the port of the database and the web server -- a common example of this is WordPress which uses Apache/MySQL.






                                                                                      share|improve this answer


























                                                                                        1












                                                                                        1








                                                                                        1







                                                                                        Some databases are designed to communicate over the web using ports assigned by the Internet Assigned Number Authority (IANA) and when run on individual PC use the ports with localhost. Some common databases with their default ports (the defualts can usually be overridden):



                                                                                        Port Database



                                                                                        1433 Microsoft SQL Server
                                                                                        https://support.microsoft.com/en-us/kb/287932



                                                                                        3306 MySQL
                                                                                        https://dev.mysql.com/doc/refman/4.1/en/connecting.html



                                                                                        5432 PostgreSQL



                                                                                        1527 Apache Derby (database)



                                                                                        Some web servers and databases are paired together such as Apache/MySQL (as in LAMP or XXAMP) or MS Internet Information Server (IIS)/MS SQL Server (IIS/SQL Server) in which case you have to be concerned with both the port of the database and the web server -- a common example of this is WordPress which uses Apache/MySQL.






                                                                                        share|improve this answer













                                                                                        Some databases are designed to communicate over the web using ports assigned by the Internet Assigned Number Authority (IANA) and when run on individual PC use the ports with localhost. Some common databases with their default ports (the defualts can usually be overridden):



                                                                                        Port Database



                                                                                        1433 Microsoft SQL Server
                                                                                        https://support.microsoft.com/en-us/kb/287932



                                                                                        3306 MySQL
                                                                                        https://dev.mysql.com/doc/refman/4.1/en/connecting.html



                                                                                        5432 PostgreSQL



                                                                                        1527 Apache Derby (database)



                                                                                        Some web servers and databases are paired together such as Apache/MySQL (as in LAMP or XXAMP) or MS Internet Information Server (IIS)/MS SQL Server (IIS/SQL Server) in which case you have to be concerned with both the port of the database and the web server -- a common example of this is WordPress which uses Apache/MySQL.







                                                                                        share|improve this answer












                                                                                        share|improve this answer



                                                                                        share|improve this answer










                                                                                        answered May 2 '15 at 18:03









                                                                                        Jim CallahanJim Callahan

                                                                                        111




                                                                                        111























                                                                                            0














                                                                                            Port: In simple language, "Port" is a number used by a particular software to identify its data coming from internet.



                                                                                            Each software, like Skype, Chrome, Youtube has its own port number and that's how they know which internet data is for itself.



                                                                                            Socket: "IP address and Port " together is called "Socket". It is used by another computer to send data to one particular computer's particular software.



                                                                                            IP address is used to identify the computer and Port is to identify the software such as IE, Chrome, Skype etc.



                                                                                            In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






                                                                                            share|improve this answer






























                                                                                              0














                                                                                              Port: In simple language, "Port" is a number used by a particular software to identify its data coming from internet.



                                                                                              Each software, like Skype, Chrome, Youtube has its own port number and that's how they know which internet data is for itself.



                                                                                              Socket: "IP address and Port " together is called "Socket". It is used by another computer to send data to one particular computer's particular software.



                                                                                              IP address is used to identify the computer and Port is to identify the software such as IE, Chrome, Skype etc.



                                                                                              In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






                                                                                              share|improve this answer




























                                                                                                0












                                                                                                0








                                                                                                0







                                                                                                Port: In simple language, "Port" is a number used by a particular software to identify its data coming from internet.



                                                                                                Each software, like Skype, Chrome, Youtube has its own port number and that's how they know which internet data is for itself.



                                                                                                Socket: "IP address and Port " together is called "Socket". It is used by another computer to send data to one particular computer's particular software.



                                                                                                IP address is used to identify the computer and Port is to identify the software such as IE, Chrome, Skype etc.



                                                                                                In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.






                                                                                                share|improve this answer















                                                                                                Port: In simple language, "Port" is a number used by a particular software to identify its data coming from internet.



                                                                                                Each software, like Skype, Chrome, Youtube has its own port number and that's how they know which internet data is for itself.



                                                                                                Socket: "IP address and Port " together is called "Socket". It is used by another computer to send data to one particular computer's particular software.



                                                                                                IP address is used to identify the computer and Port is to identify the software such as IE, Chrome, Skype etc.



                                                                                                In every home, there is one mailbox and multiple people. The mailbox is a host. Your own home mailbox is a localhost. Each person in a home has a room. All letters for that person are sent to his room, hence the room number is a port.







                                                                                                share|improve this answer














                                                                                                share|improve this answer



                                                                                                share|improve this answer








                                                                                                edited Dec 18 '18 at 3:27









                                                                                                bunbun

                                                                                                2,03132446




                                                                                                2,03132446










                                                                                                answered Dec 18 '18 at 3:00









                                                                                                Rajitha FernandoRajitha Fernando

                                                                                                11




                                                                                                11






























                                                                                                    draft saved

                                                                                                    draft discarded




















































                                                                                                    Thanks for contributing an answer to Stack Overflow!


                                                                                                    • Please be sure to answer the question. Provide details and share your research!

                                                                                                    But avoid



                                                                                                    • Asking for help, clarification, or responding to other answers.

                                                                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                                                                    To learn more, see our tips on writing great answers.




                                                                                                    draft saved


                                                                                                    draft discarded














                                                                                                    StackExchange.ready(
                                                                                                    function () {
                                                                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f1946193%2fwhats-the-whole-point-of-localhost-hosts-and-ports-at-all%23new-answer', 'question_page');
                                                                                                    }
                                                                                                    );

                                                                                                    Post as a guest















                                                                                                    Required, but never shown





















































                                                                                                    Required, but never shown














                                                                                                    Required, but never shown












                                                                                                    Required, but never shown







                                                                                                    Required, but never shown

































                                                                                                    Required, but never shown














                                                                                                    Required, but never shown












                                                                                                    Required, but never shown







                                                                                                    Required, but never shown