cancel
Showing results for 
Search instead for 
Did you mean: 

how to open a port ?

 
SOLVED
Go to solution
fizan
Super Advisor

how to open a port ?

Hi Team,

how to open a port ? i want to start a new application temp as well as across the reboot?
4 REPLIES
Steven E. Protter
Exalted Contributor
Solution

Re: how to open a port ?

Shalom,

check /etc/services for port reservations.

netstat -an

See if there is a service listening on the port.

If nothing is there, you can set it up.

The service will need the following to auto start.

start up script in /sbin/init.d

Soft links to the startup script in /sbin/rc3.d starting with an S for start up and K for kill in /sbin/rc2.d

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Torsten.
Acclaimed Contributor

Re: how to open a port ?

If you search the forum for "how to open a port ?" you get 50 results or more.

A port is "open" if "something" is listening to this port.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Mel Burslan
Honored Contributor

Re: how to open a port ?

You can not "open" a port from the operating system per-se. There is no such command as

open port 22

Although, running

/usr/sbin/sshd

when run, will start listing to port 22, which means, in your word, the port is open. I am ashamed to say that I am not a C programmer but if you want to "open" a port, you will need to employ sockets programming using C.

Opening a port usually means nothing without the application listening to port doing something though.
________________________________
UNIX because I majored in cryptology...
Torsten.
Acclaimed Contributor

Re: how to open a port ?

If you would explain your question better, you can get a more specific answer.


However, there are some classic methods to "open" a port.

Write an application that

- creates a socket
- bind this socket to an address (port)
- listen to this address

If a clients wants to connect, accept this attempt. Now server and client can communicate.

An example for this is a web server, bound to port 80, always running and listening for connection attempts.


The inetd is doing the same (more or less), but if a connection attempt arrieves, it is starting the appropriate process.
An example is telnetd.



So in general, if a process is listening on a specific port, you can consider this port as "open". If nothing is listening, it's in your wording "closed".


IMHO the terms "open" and "closed" are wrong and misleading.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!