Listen to a port
Hey Guys,
I would like to open a port 1004. My firewall is disabled. I want a program to listen to this port. Is there a way I could check if the port is open/listening? I tried telnet localhost 1004 and it keep saying connection refused. I don't know if telnet is a way to check if the port is open? Thanks |
On the server itself:
Code:
$ netstat -ltn |
This is the output for that command
Code:
Active Internet connections (only servers) |
Tcp port 1004 will appear on that list once you actually have a daemon that's listening for connections on it. Currently there isn't one.
|
Oh okay. Thank you
|
once solved,please make this thread as solved .please!
|
HI ,
Try this method to open 1004 port.. 1) check weather 1004 is listening or not. [root@Saiju-VM-2 ~]# netstat -ant | grep 1004 [root@Saiju-VM-2 ~]# 2) if it is not listening. [root@Saiju-VM-2 ~]# vi /etc/httpd/conf/httpd.conf Edit httpd.conf in apache configuration. Add Listen 1004 line . # #Listen 12.34.56.78:80 Listen 80 Listen 1004 3) restart httpd service. [root@Saiju-VM-2 ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: httpd: apr_sockaddr_info_get() failed for Saiju-VM-2 httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ OK ] 4) check weather 1004 port is listening or not.. [root@Saiju-VM-2 ~]# netstat -ant | grep 1004 tcp 0 0 :::1004 :::* LISTEN Let me know if you face any issues.. Thanks & regds Saiju |
@saiju: With respect, why in the world would he want to run an unnecessary daemon (Apache web server)?
If the goal is to put some arbitrary listener on tcp 1004, then nc(1) is lighter and is already installed on most systems. |
I tried using nc -l 1004 but it doesn't really give me any output.
|
Quote:
|
All times are GMT -5. The time now is 02:18 AM. |