L
lewmania942
Hi,
there's an original definition of a socket at the following URL:
http://java.sun.com/docs/books/tutorial/networking/sockets/definition.html
The page is called "What is a Socket?" and the description is not long.
The author states that:
I don't understand that. Moreover, there's a drawing where, upon
acceptance of a new connection, the *server* is using a new port.
I always thought that a TCP connection was uniquely identified by a
*pair* of sockets (serverort and clientort) and that a "server"
socket could be simultaneously used in several connections (and I
double checked by reading the RFCs).
That page got me so confused that I decided to do some testing.
So I did a test here on my local network. I set up Tomcat on one
machine, and configured the stateful firewall of this machine to
drop *every* packets but the ones coming from another machine
destined to the port 8080 and the ones leaving port 8080 and going
to another machine. So the server, for that simple test, wasn't
even allowed to talk to himself (ie no traffic allowed on 127.0.0.1).
I really wanted to be sure that no other port than 8080 was used
on the server.
And sure enough I could connect from several other machines to the
server... Using only port 8080 on the server.
Now I'm puzzled and I've got several questions for the
gurus out there...
1. Isn't the following phrase simply plain wrong:
!?
2. Is there a theorical limit of how many simultaneous TCP
connections a single server (no load-balancing) can handle
on a single socket? For example, could a web server accepts
100.000 simultaneous connections on port 80, from 100.000
different clients (and hence having 100.000 different
"single server socket" <--> socket pairs identifying
100.000 connections) ? (given it has enough bandwith/processing
power, etc.)
3. In one thread posted on cljh a few months ago, called "Socket woes",
someone said:
The message can be found here:
http://groups-beta.google.com/group/comp.lang.java.help/msg/a74f1800615b9b6f?dmode=source
Does a web server prevent a client from reconnecting from the exact
same IP, with the exact same (client) port number before some
time interval? Or is this precaution taken on the client's side?
Could really some hypothetical "stale packets" (in case the same
client, on the same IP, using the same "client socket") disrupt
an HTTP connection? Doesn't "HTTP over TCP over IP" prevent this?
(I mean, wouldn't those "stale packets" simply be discarded?)
Thanks in advance for any explanations,
Lew
there's an original definition of a socket at the following URL:
http://java.sun.com/docs/books/tutorial/networking/sockets/definition.html
The page is called "What is a Socket?" and the description is not long.
The author states that:
If everything goes well, the server accepts the connection. Upon
acceptance, the server gets a new socket bound to a different port.
It needs a new socket (and consequently a different port number) so
that it can continue to listen to the original socket for connection
requests while tending to the needs of the connected client.
I don't understand that. Moreover, there's a drawing where, upon
acceptance of a new connection, the *server* is using a new port.
I always thought that a TCP connection was uniquely identified by a
*pair* of sockets (serverort and clientort) and that a "server"
socket could be simultaneously used in several connections (and I
double checked by reading the RFCs).
That page got me so confused that I decided to do some testing.
So I did a test here on my local network. I set up Tomcat on one
machine, and configured the stateful firewall of this machine to
drop *every* packets but the ones coming from another machine
destined to the port 8080 and the ones leaving port 8080 and going
to another machine. So the server, for that simple test, wasn't
even allowed to talk to himself (ie no traffic allowed on 127.0.0.1).
I really wanted to be sure that no other port than 8080 was used
on the server.
And sure enough I could connect from several other machines to the
server... Using only port 8080 on the server.
Now I'm puzzled and I've got several questions for the
gurus out there...
1. Isn't the following phrase simply plain wrong:
It needs a new socket (and consequently a different port number)
so that it can continue to listen to the original socket for
connection requests while tending to the needs of the connected
client.
!?
2. Is there a theorical limit of how many simultaneous TCP
connections a single server (no load-balancing) can handle
on a single socket? For example, could a web server accepts
100.000 simultaneous connections on port 80, from 100.000
different clients (and hence having 100.000 different
"single server socket" <--> socket pairs identifying
100.000 connections) ? (given it has enough bandwith/processing
power, etc.)
3. In one thread posted on cljh a few months ago, called "Socket woes",
someone said:
After a socket is closed the port number remains unavailable
for a time (four minutes "by statute," IIRC, although it's
fairly common for Web servers to use shorter intervals); this
is to allow time for stale packets to expire from the network.
(You wouldn't want a packet that had been temporarily trapped
in a routing loop to escape and disrupt a new unrelated
connection that happened to use the same port number ...)
The message can be found here:
http://groups-beta.google.com/group/comp.lang.java.help/msg/a74f1800615b9b6f?dmode=source
Does a web server prevent a client from reconnecting from the exact
same IP, with the exact same (client) port number before some
time interval? Or is this precaution taken on the client's side?
Could really some hypothetical "stale packets" (in case the same
client, on the same IP, using the same "client socket") disrupt
an HTTP connection? Doesn't "HTTP over TCP over IP" prevent this?
(I mean, wouldn't those "stale packets" simply be discarded?)
Thanks in advance for any explanations,
Lew