W
William Stacey [MVP]
And I still have the same response - to have multiple connections which
I assume by protocol, you are talking about network protocols like udp/tcp?
No?
You can do this with one port. If your talking application level protocols,
you can still do it on one port. Assuming you have some kind of message
format and not just streaming. If we are talking upd, this is really easy.
It's not a generalisation like that "is good, that bad". It's question of
how to properly and efficiently design a server. It's like someone saying
they will design their server with 1000 threads so 1000 clients can connect.
Someone who said that, would need some comments as to why that is probably
not a good idea. Sure you "can" do it, if you want to be literal. The
reasons stated from the OP are no reason to use multiple ports/listeners on
a server.
And we agree. Heh.
As we are talking sockets and ports, I assumed we by protocols, you mean
udp/tcp.
"single port should only service a single protocol"?? Don't tell DNS that
has been listening for UDP and TCP on port 53 for 20+ years. A quick review
of the services file will show you some of the services that listen for udp
and tcp on the port.
Gee. Isn't that what I have been saying. You said ports are not limited,
now they are?
Agreed. This would be akin to sharing a mutex name or some other kernel
sync object. Somehow the other process must know what to connect to. So
you can "fix" it upfront or do it dynamically, share the info via the reg,
etc. No problems here.
My point was actually a very simple one meant to the help the OP. Via his
post, it seemed to me that he *thought, the only way you could have multiple
clients is to have multiple ports. This obviously is wrong and not needed
for stated for purpose (unless the purpose is not stated fully.) I never
said I could never think of a situation where it could be useful, nor did
anyone ask. I never say never (at least I try not to). I think we are
probably done with this. Cheers
don't require the same protocol.
I assume by protocol, you are talking about network protocols like udp/tcp?
No?
You can do this with one port. If your talking application level protocols,
you can still do it on one port. Assuming you have some kind of message
format and not just streaming. If we are talking upd, this is really easy.
Neither can I. That doesn't mean your generalisation is correct though.
It's not a generalisation like that "is good, that bad". It's question of
how to properly and efficiently design a server. It's like someone saying
they will design their server with 1000 threads so 1000 clients can connect.
Someone who said that, would need some comments as to why that is probably
not a good idea. Sure you "can" do it, if you want to be literal. The
reasons stated from the OP are no reason to use multiple ports/listeners on
a server.
Indeed - and if a firewall might be involved, it's clearly a bad idea.
However, that's not always the case.
And we agree. Heh.
I don't see where UDP comes in here. A single port should only service
a single protocol. What you can do is have two ports, one for one
protocol and one for another, of course. That would be a better answer
to my suggested "problem". However, here's another scenario:
As we are talking sockets and ports, I assumed we by protocols, you mean
udp/tcp.
"single port should only service a single protocol"?? Don't tell DNS that
has been listening for UDP and TCP on port 53 for 20+ years. A quick review
of the services file will show you some of the services that listen for udp
and tcp on the port.
You have an app which you don't want to allocate a fixed port number
for (as fixed port numbers are limited, so there may be clashes).
Gee. Isn't that what I have been saying. You said ports are not limited,
now they are?
However, you want to communicate in a simple stream-based fashion, e.g.
with other instances of the same app running on the same box. You could
use some other IPC mechanism to share the port number, but that IPC
mechanism may not be nearly as well suited to the rest of the data
streaming as simple networking (which may already be part of the app
for other reasons). Dynamically creating a port and then sharing the
number creates a simple clash-free stream.
Agreed. This would be akin to sharing a mutex name or some other kernel
sync object. Somehow the other process must know what to connect to. So
you can "fix" it upfront or do it dynamically, share the info via the reg,
etc. No problems here.
And I'm saying that while there *may* not be a need, saying that
dynamically allocated port numbers is *never* needed (or at least
advantageous) is being short-sighted.
My point was actually a very simple one meant to the help the OP. Via his
post, it seemed to me that he *thought, the only way you could have multiple
clients is to have multiple ports. This obviously is wrong and not needed
for stated for purpose (unless the purpose is not stated fully.) I never
said I could never think of a situation where it could be useful, nor did
anyone ask. I never say never (at least I try not to). I think we are
probably done with this. Cheers