[Standards] binding to tcp for s2s communication
MIndelicato at g8wave.com
Fri Mar 7 18:07:10 UTC 2008
I'm trying to implement a .NET xmpp SDK for both the server and the
client. It's been going well so far, but I've fallen victim to what I
believe might be some contradiction (or a misunderstanding on my part)
of the core specification (rfc3930).
Take a look at the following description of how a TCP should be used to
connect two peer servers to eachother:
"4.2. Binding to TCP
Although there is no necessary coupling of an XML stream to a [TCP]
(Postel, J., "Transmission Control Protocol," September 1981.)
<http://www.xmpp.org/rfcs/rfc3920.html#TCP> connection (e.g., two
entities could connect to each other via another mechanism such as
polling over [HTTP] (Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer
Protocol -- HTTP/1.1," June 1999.)
<http://www.xmpp.org/rfcs/rfc3920.html#HTTP> ), this specification
defines a binding of XMPP to TCP only. In the context of
client-to-server communications, a server MUST allow a client to share a
single TCP connection for XML stanzas sent from client to server and
from server to client. In the context of server-to-server
communications, a server MUST use one TCP connection for XML stanzas
sent from the server to the peer and another TCP connection (initiated
by the peer) for stanzas from the peer to the server, for a total of two
TCP connections. "
Now, based on my understanding of the above paragraph, the standard
states that I should be using an separate inbound and an outbound TCP
connection for each peer server - fine, no problem. The part I'm getting
stuck on is that in section 14.4 of the core spec, it suggests using
port 5269 for server2server communication.
So my question is this, what is the proper implementation of this
standard, taking into consideration that you can't bind a socket in any
language that I'm aware of, to a port that has already been bound by
another socket? For example, if I locally bind SERVER1's outbound TCP
socket to 5269 and make a connection to SERVER2's inbound TCP socket on
5269, then I'm ok. But when SERVER2, tries to then locally bind its
separate outbound socket to 5269, in an attempt to connect to SERVER1's
inbound socket, it can't because the outbound socket is already bound to
that port. This is a problem on both ends really - simply put, you can't
bind two separate TCP sockets to the same port (inbound and outbound
being those two separate sockets).
Make sense? Any clarification would be greatly appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Standards