Results 1 to 2 of 2

Thread: Ports question

  1. #1
    Antionline Herpetologist
    Join Date
    Aug 2001

    Ports question

    I've been asked this question by a friend, and since I don't know the answer, I was wondering if any of you could help.
    Assume that there's a service, say a web server, listening on a particular port, in this case 80 then, what would the service do if it gets multiple requests at the same time? Say if both you and I access the site at the same time, how does the service handle the requests (as it has only one available port)?
    Buy the Snakes of India book, support research and education (sorry the website has been discontinued)
    My blog: http://biology000.blogspot.com

  2. #2
    Junior Member
    Join Date
    Jan 2002
    The service handles requests by spawning another process that handles your request (forking). Its like, if you go to a bank, the security guard points you to a teller. The security guard would be the "main" program (the program on port 80), and the teller would be the forked program (the spawn of the main program on another port). Spawned processes are given some arbitrarily high-numbered port, so they don't interfere with other processes. So, if 5 people go to a website, the main program will fork 5 spawned processes to accommodate each person.

    Note - If a webserver never spawned other processes, it would only have 1 port to send/recieve information from. This means it would only support 1 person on its webpage.

    Feel free to email me if you have any further questions!

    Stretch your MIND

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts