67 var _ io.Closer = &Client{} |
67 var _ io.Closer = &Client{} |
68 |
68 |
69 // Connect to the appropriate server and authenticate as the given JID |
69 // Connect to the appropriate server and authenticate as the given JID |
70 // with the given password. This function will return as soon as a TCP |
70 // with the given password. This function will return as soon as a TCP |
71 // connection has been established, but before XMPP stream negotiation |
71 // connection has been established, but before XMPP stream negotiation |
72 // has completed. The negotiation will occur asynchronously, and sends |
72 // has completed. The negotiation will occur asynchronously, and any |
73 // to Client.Out will block until negotiation is complete. |
73 // send operation to Client.Out will block until negotiation (resource |
|
74 // binding) is complete. |
74 func NewClient(jid *JID, password string) (*Client, os.Error) { |
75 func NewClient(jid *JID, password string) (*Client, os.Error) { |
75 // Resolve the domain in the JID. |
76 // Resolve the domain in the JID. |
76 _, srvs, err := net.LookupSRV(clientSrv, "tcp", jid.Domain) |
77 _, srvs, err := net.LookupSRV(clientSrv, "tcp", jid.Domain) |
77 if err != nil { |
78 if err != nil { |
78 return nil, os.NewError("LookupSrv " + jid.Domain + |
79 return nil, os.NewError("LookupSrv " + jid.Domain + |