public final class TcpConnection extends Connection
If no hostname is set (null or empty) the connection tries to resolve the hostname via an SRV DNS lookup.
This class is unconditionally thread-safe.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the TCP connection.
|
void |
connect()
Deprecated.
|
void |
connect(Jid from)
Connects to the specified XMPP server using a socket connection.
|
String |
getStreamId()
Gets the stream id of this connection.
|
boolean |
isSecure()
Indicates whether this connection is secured by TLS/SSL.
|
void |
send(ClientStreamElement element)
Sends an element.
|
String |
toString() |
getHostname, getPort, getProxy, getXmppSession, initialize@Deprecated public final void connect() throws IOException
Connectionconnect in class ConnectionIOException - If no connection could be established, e.g. due to unknown host.public final void connect(Jid from) throws IOException
XmppSession.login(String, String) method.
If only a XMPP service domain has been specified, it is tried to resolve the FQDN via SRV lookup.
If that fails, it is tried to connect directly the XMPP service domain on port 5222.
If a hostname and port have been specified, these are used to establish the connection.
If a proxy has been specified, the connection is established through this proxy.
connect in class Connectionfrom - The optional 'from' attribute in the stream header.IOException - If the underlying socket throws an exception.public boolean isSecure()
ConnectionisSecure in class Connectionpublic final void send(ClientStreamElement element)
Connectionsend in class Connectionelement - The element.public final void close()
throws Exception
</stream:stream>, then shuts down the writer so that no more stanzas can be sent.
After that it shuts down the reader and awaits shortly for any stanzas from the server and the server gracefully closing the stream with </stream:stream>.
Eventually the socket is closed.IOException - If the socket throws an I/O exception.Exceptionpublic final String getStreamId()
ConnectiongetStreamId in class ConnectionCopyright © 2014–2015 XMPP.rocks. All rights reserved.