Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I developed an app in Java (which is working perfectly; with this app you can scan TCP/UDP ports -for testing purposes only-), but meanwhile when I was writing the code I read several documentation (wiki) about sockets. I thought open port is mean, a protocol where the client/server can establish/bind a connection even if there are nothing on the server side which can handle/response data. I thought open port is mean (if there are no routers/firewalls) a protocol which is ready to be used.

I was testing my application on my local server machine, but at first I thought my application is not working. It was working, but there was no any software which could response to my queries. After I opened my APACHE server and I wrote a simple UDP server (which can handle/response to any query on a specific port) the application was able to find those ports.

I thought listening port is a port which is used and it's opened. What does listening port is meaning?

If I send UDP packets to a remote host and there are no closed ports (router or firewall) what happens to the packet? Does the data is written in the buffer? Or it simply ignores/denies the packet.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Listening ports are used in servers. If you have an apache web server for example, it does not know in advance when it will be used. Listening means that it just waits (like a recepcionist in a hotel :) and it is ready to send an answer whenever a client program (a browser for example) requests it. The connection becomes open when a client connects to that port and a conversation begins.

If no program is listening on a port, and a client tries to connect, then the operating system will reject it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.