C2S connection life cycle
To start exchanging stanzas between the client and server, an XMPP client must first form a connection with a server and start an XML stream. XMPP servers are generally found using a Domain Name System (DNS) Service record (SRV). If an SRV record does not exist, the client will attempt to connect to the resolved domain directly otherwise, a hostname can be supplied by the user themselves.
Once a connection has been formed, a stream will be started using the following message:
<?xml version="1.0"> <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0" to="brown.sci">
The server will then form its own return stream with the client in response:
<?xml version="1.0"> <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0" from="brown.sci" id="stream:1a3f"> <stream:features> <starttls xmlns="urn:ietf:params:xml...