regarding TCP/IP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ushach
    New Member
    • Nov 2006
    • 17

    regarding TCP/IP

    I have some doubts regarding Tcp/Ip.how one can identify packets belongs to a particular process.(ie)whi le browising we r simultaniously requesting for Yahoo.Google... .,and so many.how the response packets r sending exacltly to those yahoo,Google in windows.Which part of OS is esponsible for it?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    I assume you mean if you have 2 Windows (or Tabs) open in IE (or Firefox or whatever browser you use).

    it is part of how the connection works (not really a part of the OS but part of the specification of sockets).

    When you request a page from Google your browser opens a socket on a specific port of your computer and then connects to the Google server using it's IP address to locate it and port 80 (because that is the normal listening port for HTTP traffic). The IP address of you computer and the port number of the application are embedded in the TCP/IP packets sent to Googles server so when it sends back the HTML page data it knows where to reply to. It sends the data to your IP address and port number, when your comupter receives the data the socket layer uses the port number to route the packet to the correct application.

    So if you simultaneously request data from Yahoo in another browser window/tab another socket is open (because sockets are point to point connections) with a new port number. because the port number is different when the data is returned it gets routed to the new Window/tab with the new socket.



    This of course all gets a little messed up if you are sat behind a router (which you are, either at home, or at your ISP or at work) because the router does IP address and port remapping, that is when it receives TCP/IP packets from your computer it may insert a different IP address or port number (or both) into the packet. The router then keeps a record of this so that when it receives the reply to the altered IP address/port number if re-writes the orginal IP address and port number into the reply packet and forwards this packet to tyour computer.

    It is this method of IP address/port re-writing that allows a router to present a fix (small) number of IP addresses to the internet (or at least the next subnet up) while handling connections from many computers on the its private side (your home network).

    Comment

    • Ushach
      New Member
      • Nov 2006
      • 17

      #3
      thanks for giving me the reply.Is it possible to identify the process based on the destination address and portno?Yahoo,Go ogle all use HTTP, port80 only.So each has it's own socket Is this correct?

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Originally posted by Ushach
        Thanks for giving me reply,u gave me reply as,
        So if you simultaneously request data from Yahoo in another browser window/tab another socket is open (because sockets are point to point connections) with a new port number.

        Yahoo is using HTTP protocol.So it has to use port 80.then why it creates another socket with different port number?what is the difference between socket and port?
        . .

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          Remember there is a socket with it's own port number at each end of the link, so Yahoo and Google each have open listening sockets on port 80.

          When you connect to Yahoo your computer creates a socket on a random(ish) port to connect to the Yahoo listening socket on port 80

          You:PortX <-> Yahoo:80

          When you connect to Google your computer creates another socket on another random(ish) port to connect to the google listening socket on port 80

          You:PortY <-> Google:80

          In these cases it is unlikely that either PortX or PortY will be 80, the port numbers at each end of a link do not have to match (and in reality rarely do match).

          The port defines the application (or protocol) thaat the conenction will be using and most port numbers below 1024 are reserved for specific applications (there is a list here).

          The reason that Yahoo, Google and all other web servers listen on port 80 is that your browser has to know which port it has to connect to in order to attach to the web-server. The only way to do this globally is if the port number is fixed, so all web-servers listen on port 80.

          This is not a requirement though, you could set up a web server that listened on port 1200 but then you would have to include the port number in the URL when you typed the address into your browser so that it wouldn't use the default of 80.

          Comment

          • Ushach
            New Member
            • Nov 2006
            • 17

            #6
            how incoming packets of yahoo,google reach their destination.how the packets bind to a particular socket?

            Comment

            • Banfa
              Recognized Expert Expert
              • Feb 2006
              • 9067

              #7
              The packet contins the IP address and port number that it is destined for so the socket driver can read that and send it to the correct socket/program.

              Comment

              • Cyberdyne
                Recognized Expert Contributor
                • Sep 2006
                • 627

                #8
                Start your PC and connect to Yahoo.com and then in a separate Window Connect to Google.com

                then I want you to go to start and press start .. type in cmd and hit OK

                when the command prompt window comes up I want you to type in netstat there you can see the website connections and port number they use, hopefully this will give you a better idea to you question.


                Regards, Cyber.

                Comment

                • Ushach
                  New Member
                  • Nov 2006
                  • 17

                  #9
                  Originally posted by Banfa
                  The packet contins the IP address and port number that it is destined for so the socket driver can read that and send it to the correct socket/program.
                  That means Socket Driver ia a program which stores SocketNo,PortNo ,Ipaddress and then maps the Incoming packet according to it.Is it inbuilt of operating system?

                  Comment

                  • Banfa
                    Recognized Expert Expert
                    • Feb 2006
                    • 9067

                    #10
                    Originally posted by Ushach
                    That means Socket Driver ia a program which stores SocketNo,PortNo ,Ipaddress and then maps the Incoming packet according to it.Is it inbuilt of operating system?
                    It isn't a program and it isn't really part of the OS.

                    The drivers that drive the network hardware are part of the OS but the Socket Driver is a library that you build into your program that then communicates with the network hardware driver.

                    How the data is managed between the lower levels of the software I don't know but I would imagine that actually the Network Driver would be the one to store that data (otherwise the Netstat function would have trouble working).

                    Comment

                    Working...