Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

What opens a TCP port

Options
  • 09-01-2010 3:24pm
    #1
    Registered Users Posts: 5,580 ✭✭✭


    Hi

    I use the following command

    lsof -i :50340

    To check if a certain TCP port is "listening"


    When it is not listening, how do you get it to listen. Is it done from the application itself or is there another way


Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    An application must open a socket that listens on a specific port.

    For example, an FTP server would listen on port 21, a web server would listen on port 80 etc.


  • Subscribers Posts: 4,076 ✭✭✭IRLConor


    Q: What opens a TCP port?
    A: A TCP Harbour Master.

    :D

    Seriously though: have a look at netcat (man nc) and you should be able to easily get something listening on a given port. What exactly are you trying to do?


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Just to note, there are two specific types of sockets at least under Unix OS's.

    Domain sockets are used for interprocess communication between local applications
    in Unix(Process communication) whereas Network sockets are used for you guessed
    it...network communication over TCP/IP or whatever the hell you want.


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Hi

    I use the following command

    lsof -i :50340

    To check if a certain TCP port is "listening"


    When it is not listening, how do you get it to listen. Is it done from the application itself or is there another way

    There is a script associated with the application under /etc/init.d/<service.name>
    for SysV like distros like Debian or /etc/rc.d/rc.<service_name> or for BSD like systems.

    So Apache is started with /etc/init.d/apache start, which binds apache to port 80 or a user
    specified port specified by the config file "httpd.conf", which is read by the server at runtime.

    The C application itself opens the port on behalf of the program, by using low
    level socket interfaces detailed in the C standard library.


  • Registered Users Posts: 885 ✭✭✭clearz


    An operating system implements a network stack wich usually handles TCP/IP Each network layer is separate to the one above check out this for more info
    http://en.wikipedia.org/wiki/OSI_model


  • Advertisement
Advertisement