Tim Judd wrote:
Hi Pid, all
I'm disappointed the responses I've gotten seemingly to be scolding messages. I
am reading up on documentation, I am reading the APIs, I am reading everything I
can. Think of Citrix (in Windows environments) - code is executed on the server
and displayed on your desktop; X11 forwarding does the same thing. I don't know
which machine is executing the code
I understand you guys are trying to help, but I am disappointed all I'm hearing
is "you're doing it wrong" basically. I was hoping a quick answer to know which
machine is executing the code which would be the same side that has it bound.
Does anyone know which machine will bind?
You are not being scolded, you are being pointed to sources of information about TCP/IP
which may help you phrase your questions in a way that people here may have an easier time
understanding and answering.
Nobody really feels like re-writing what these articles already explain at length, and
which has basically nothing to do with helping people with Tomcat, which is what the
helping souls on this forum are trying to do.
Not because you are - wrongly - complaining, but because it may avoid other people wasting
their time, here is a brief overview :
- a socket is a OS-level structure which represents a "network channel" between 2
applications (possibly on different computers)
- there are 2 types of sockets :
- a "server" (or "listening") socket
- a "client" socket
- the terms "bind" or "binding" are used only with the "server" type of socket
- an application can request from the OS to allocate (or "open") a socket for it, and when
it does that, it specifies if it wants a "server" or "client" socket.
If the requested socket is of the "server" type, then the action of requesting this socket
may be called "binding".
- a server socket is "passive" : it sits there, waiting for connections to it. When it
receives a connection, it informs the application that is "bound" to it. This server
application can then read what the other party (a client) sent to this socket, and respond
over the same socket.
- a client socket's purpose is usually to be used to "connect" to a distant
server socket.
Normally the purpose is to allow the application which owns the client socket, to send
some request or message to the application which is bound to the server socket (which is
at the other end of the link), and to receive a response over that same channel and socket.
- all the above is true for TCP, and a bit less so for UDP.
- and finally, no matter what type of socket we are talking about, when an application
asks the OS to create (open) a socket for it, it is always on the same server where this
application runs. So an application running on server A, can only bind to or open a
socket on server A.
Do you understand now why your questions are a bit confusing ?
Just quoting one of them :
"If I develop a webapp that listens for TCP/UDP sockets, which machine is
actually listening?"
Hopefully, the above makes clear that an application does not "listen for sockets", and
why everyone here is a bit uncertain about what to answer.
And a webapp usually does not open any kind of socket, since it (indirectly) receives
requests and sends responses through Tomcat (which does own sockets for that).
A webapp could open a separate client socket, but it would only do that if it wanted
itself to talk, as a client, to some separate server application somewhere.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]