How tcp/ip client server listening sockets work...

Posted on 2007-08-12
Last Modified: 2013-11-13
I know that in the client server pardigm of tcpip-based sockets, the server app listens at a specific IP address and port number....

The server app then spawns? a connection such that any subsequent socket communication between the client and the server is done via another port number? My understnading is that this is necessary so as to enable the server to keep listening on the listening port and to be able to handle multiple requests....

In terms of enabling this communication when using a firewall, do port numbers other than the one being used as a listening socket need to be freed up to permit the "after the listen socket answers the call" connection establishment to take place?

Question by:smmsmm57
    LVL 36

    Expert Comment

    Yes the server app does usually spawn or at least there is a new thread started within the main process in order for the software to be able to handle multiple simultaneous connections.

    However the port number does not change. When the client makes a connection to a server it does so from its IP address and a high numbered port (1024 - 65535) and it is the operating system at the servers end which keeps record of all the open connections and passes the data from the client to the correct server process bases upon the source IP address and port.
    LVL 36

    Accepted Solution

    Therefore as far as the firewall is concerned you just permit traffic to the servers port (port 80 for standard web traffic for example).
    There are a few awkward protocols such as FTP where a separate connection is used to transfer the data so the firewall needs to open these up aswell. Most firewalls inspect the commands issued on a FTP connection to see what ports are going to be used for the data connection and automatically open these for that single session.
    LVL 32

    Assisted Solution

    Good idea to go through this video hands-on; simple + small + good


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now