使用版本:1.1.10今天弄了一下Gloox中自带的收发文件例子,收发文件的例子都是好使的,只不过,在调试过程中需要注意一些问题,下面将我遇到的问题做个记录(例子中以In-Band Bytestreams方式收发)。1、发送文件过程中遇到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地址换成服务器名称试试JID j( "www@192.168.60.67/gloox" );——> JID j( "www@wanghaiguang-wk/gloox" );
2、发送文件过程中遇到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>
这个问题可能是由于你接收端的资源名称与发送端不匹配//接收端登录的jid
JID jid( "www@192.168.60.67/glooxsendfile" );
j = new Client( jid, "111" );
//发送端的jid名称(发送给对方的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
王海光 阅读(2451)
评论(0) 编辑 收藏 引用 所属分类:
Openfire&Gloox