XMPPFramework - 如何将图像从一台设备传输到另一台设备? [英] XMPPFramework - How to transfer image from one device to another?

查看:60
本文介绍了XMPPFramework - 如何将图像从一台设备传输到另一台设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 XMPP 协议进行了一对一聊天.现在,我想在我的应用程序中发送图像和视频.我研究了文件传输,但没有找到解决方案.我也使用了下面的代码进行 Socket 连接.

I have made one-to-one chat using XMPP protocol. Now, I would like to send image and video in my application. I researched about the file transfer but I didn't find a solution. I have also used the code below for Socket connection.

请建议我如何去做.

[TURNSocket setProxyCandidates:@[@"MyserverHost-desktop"]];

XMPPJID *jid = [XMPPJID jidWithString:@"1254225445@MyserverHost-desktop"];

TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:[[self appDelegate]xmppStream] toJID:jid];

[app.turnSocketArray addObject:turnSocket];
[turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
[turnSocket release];

- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket
{
}

- (void)turnSocketDidFail:(TURNSocket *)sender
{
}

每次连接失败方法调用..

Every time connection fail method call..

谢谢.

推荐答案

您需要将图片推送到服务器,然后您将从服务器接收一个 url.然后您可以通过 xmpp 协议将该 url 发送到另一个设备.到底.通过接收到的url从服务器下载图像.

you need push the image to server and you will reveice a url from server .then you can send the url to another device by xmpp protocol. in the end. download the image from server by the received url.

xmpp 也可以发送图像.但这对于 xmpp 服务器来说是一个很大的 xml 消息.这不是一个很好的解决方案.

xmpp also can send image . But that's a big xml message for xmpp server .that's not a great solution.

这篇关于XMPPFramework - 如何将图像从一台设备传输到另一台设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆