[Standards] binding to tcp for s2s communication

Dave Cridland dave at cridland.net
Fri Mar 7 18:12:03 UTC 2008


On Fri Mar  7 18:07:10 2008, Max Indelicato wrote:
> 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).

Indeed... But you don't need to use 5269 for outgoing connections -  
it's only used as the destination port. Your source port can be  
anything, and is usually left "unbound" - as in, you let the OS do  
the binding.

Otherwise no, you wouldn't be able to have two TCP connections both  
with source and destination ports being 5269.

Dave.
-- 
Dave Cridland - mailto:dave at cridland.net - xmpp:dwd at jabber.org
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade



More information about the Standards mailing list