使用版本:1.1.10今天弄了一下Gloox中自帶的收發(fā)文件例子,收發(fā)文件的例子都是好使的,只不過,在調(diào)試過程中需要注意一些問題,下面將我遇到的問題做個記錄(例子中以In-Band Bytestreams方式收發(fā))。1、發(fā)送文件過程中遇到404錯誤<iq type='error' id='uid-8509a748-00000005' to='wanghaiguang@wanghaiguang-wk/glooxsendfile'from='www@192.168.60.67/Spark 2.6.3'><sixmlns='http://jabber.org/protocol/si' id='uid-8509a748-00000006' profile='http://jabber.org/protocol/si/profile/file-transfer'><file xmlns='http://jabber.org/protocol/si/profile/file-transfer' name='d:\offline.bmp' size='6998'/><feature xmlns='http://jabber.org/protocol/feature-neg'><x xmlns='jabber:x:data' type='form'><field type='list-single'var='stream-method'><option label='ibb'><value>http://jabber.org/protocol/ibb</value></option><option label='oob'><value>jabber:iq:oob</value></option><option label='s5b'><value>http://jabber.org/protocol/bytestreams</value></option><value/></field></x></feature></si><error code='404' type='cancel'><remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
可以將ip地址換成服務(wù)器名稱試試JID j( "www@192.168.60.67/gloox" );——> JID j( "www@wanghaiguang-wk/gloox" );
2、發(fā)送文件過程中遇到503錯誤<iq type='error' id='uid-8663a748-00000005' from='www@wanghaiguang-wk/glooxsend'to='wanghaiguang@wanghaiguang-wk/glooxsendfile'><si xmlns='http://jabber.org/protocol/si' id='uid-8663a748-00000006' profile='http://jabber.org/protocol/si/profile/file-transfer'><file xmlns='http://jabber.org/protocol/si/profile/file-transfer' name='d:\offline.bmp' size='6998'/><feature xmlns='http://jabber.org/protocol/feature-neg'><x xmlns='jabber:x:data' type='form'><field type='list-single' var='stream-method'><option label='ibb'><value>http://jabber.org/protocol/ibb</value></option><option label='oob'><value>jabber:iq:oob</value></option><option label='s5b'><value>http://jabber.org/protocol/bytestreams</value></option><value/></field></x></feature></si><error code='503' type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
這個問題可能是由于你接收端的資源名稱與發(fā)送端不匹配//接收端登錄的jid
JID jid( "www@192.168.60.67/glooxsendfile" );
j = new Client( jid, "111" );
//發(fā)送端的jid名稱(發(fā)送給對方的jid名稱)
JID j( "www@wanghaiguang-wk/gloox" );
if( j.resource().empty() )
{
printf( "error: need full jid\n" );
return 1;
}
posted on 2014-09-02 17:18
王海光 閱讀(2471)
評論(0) 編輯 收藏 引用 所屬分類:
Openfire&Gloox