四:Smack文檔的下載和初步瞭解

      從本篇開始就要進入代碼篇,寫代碼需要看一下文檔,所以我們先下載一個Smack文檔。

一:Smack文檔的下載

1、下載最新的Smack文檔

    官方下載站點:

    http://www.igniterealtime.org/downloads/index.jsp

    下載smack_4_0_1.zip


解壓後有三個文件夾:javadoc,libs,releasedocs。打開releasedocs-documentation-index.html


讓我們先看一下Overview翻譯一下,翻譯不對的請多多指教。吐舌頭

Smack Overview

Smack is a library for communicating with XMPP servers to perform real-time communications, including instant messaging and group chat.

翻譯:smack是一個與XMPP服務器進行實時通信的庫,包括即時消息和羣組聊天。

Smack Key Advantages

翻譯:smack關鍵優勢

Extremely simple to use, yet powerful API. Sending a text message to a user can be accomplished in only a few lines of code:

翻譯:使用極其簡單,但API的功能很強大。發送文本消息給用戶只需要幾行代碼就可以完成:

Connection connection = new XMPPConnection("jabber.org");
connection.connect();
connection.login("mtucker", "password");
Chat chat = connection.getChatManager().createChat("[email protected]", new MessageListener() {

    public void processMessage(Chat chat, Message message) {
        System.out.println("Received message: " + message);
    }
});
chat.sendMessage("Howdy!");

解釋一下:

"jabber.org":是服務器地址,例如192.168.1.103

"mtucker""password":是登錄的用戶名和密碼,

"[email protected]":就是所說的jid,@前面的是登錄的用戶名後面的是第二篇的第六條6.配置服務器域名的域

Doesn't force you to code at the packet level, as other libraries do. Smack provides intelligent higher level constructs such as the Chat and Roster classes, which let you program more efficiently.

翻譯:不強迫你在包級別去編碼,和其他庫一樣。Smack提供智能更高層次結構像聊天和組,這讓你的程序更有效。

Does not require that you're familiar with the XMPP XML format, or even that you're familiar with XML.

翻譯:不要求你熟悉XMPP XML格式,甚至您熟悉XML。

Provides easy machine to machine communication. Smack lets you set any number of properties on each message, including properties that are Java objects.

翻譯:提供簡單的機對機通信。對於每一個消息Smack讓你設置任意數量的屬性,包括Java對象的屬性。

Open Source under the Apache License, which means you can incorporate Smack into your commercial or non-commercial applications.

翻譯:開放源碼在Apache許可下,這意味着您可以讓Smack進入你的商業或非商業應用。

About XMPP

翻譯:關於XMPP

XMPP (eXtensible Messaging and Presence Protocol) is an open protocol standardized by the IETF and supported and extended by the XMPP Standards Foundation ((http://www.xmpp.org).

翻譯:XMPP(可擴展消息處理現場協議)是一個開放的協議由IETF標準化和XMPP支持和擴展的標準基金會((http://www.xmpp.org)。

How To Use This Documentation

翻譯:如何去使用這個文檔

This documentation assumes that you're already familiar with the main features of XMPP instant messaging. It's also highly recommended that you open the Javadoc API guide and use that as a reference while reading through this documentation. 

翻譯:本文檔假設你已經熟悉XMPP即時消息的主要特點。也強烈建議您打開Javadoc API嚮導並作爲參考使用,在閱讀這個文檔的時候


翻譯完了,其他項我就不翻譯了,你們可以自己讀一讀,最後他建議我們去打開javadoc作參考,那我們就打開javadoc-index.html看一下,



嗯,不錯,有各種包和類,你們先看看,下一篇開始寫登錄代碼。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章