-
Website
http://danielmiessler.com/ -
Original page
http://danielmiessler.com/blog/security-how-network-ports-work -
Subscribe
All Comments -
Community
-
Top Commenters
-
'Dapo Osewa
3 comments · 1 points
-
Maxo
18 comments · 2 points
-
cooperati
127 comments · 2 points
-
dapxin
11 comments · 1 points
-
icepyro
3 comments · 1 points
-
-
Popular Threads
-
Islam: It’s the Intolerance That’s Scary
3 weeks ago · 19 comments
-
Chrome > Firefox
1 week ago · 4 comments
-
Disk Performance: Slicehost vs. Linode
2 weeks ago · 7 comments
-
Creation vs. Collection
2 weeks ago · 5 comments
-
How to Manage a Cisco Device via Console Using a USB Port in OS X
1 week ago · 2 comments
-
Islam: It’s the Intolerance That’s Scary
I know that a webserver listening on the default HTTP port of 80 will "lock" that port on a machine. Two processes can't listen on the same port (at least with any OS's I'm familiar with).
But when I'm on my desktop, does my browser use a port to send/receive data from a webserver?
If I'm running a local webserver listening on port 80, and then on the same machine I use my browser ... how does the response traffic not go to my webserver (thus confusing everyone involved)?
/boggle
The 'connection' between your web browser and the web server is between the port on your machine and the port on theirs. Typically connections *from* your machine will be made above port 1024, if not higher, *to* a server on a port below 1024.
So, your web server listens on port 80, and your web browser 'listens' on a higher port, for the specific task of talking to the remote web server for one session.
Hope this makes a bit of sense.. :)
-- Arik
"Hey all you midgets in there! Quit yackin' and get back to work!"
In general, "client" ports (also called ephemeral ports) are very high -- often in the many thousands. The low ports (especially those below 1024) are reserved for common services such as web, ftp, telnet, etc.
So think of it this way -- each side of a connection has two things: 1) an IP address, and 2) a port. Usually the server side will be a low port and the client a high one, but it depends on the application so that's not always the case.
Hope this helps...
**We represent the Lollipop Guild, the Lollipop Guild, the Lollipop Guild**
So this (from lsof) makes more sense now:
firefox-b 250 yur 43u IPv4 0x4177018 0t0 TCP 10.0.0.102:53475->ar-in-f104.google.com:http (ESTABLISHED)
Firefox has an open connection with Google using my local port 53475, right? I guess outbound connections pick a random port and make sure it isn't in use or something? I assume there is a nice POSIX system call for this sort of thing? get_an_unused_user_port() sort of thing?
Thanks for the info.