如何发送和通过socket接收图像 [英] how to send and receive image through socket

查看:240
本文介绍了如何发送和通过socket接收图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从一个Android设备发送图像到一个或多个Android设备。
所以该机制我应该遵循从一个Android设备发送图像到另一台Android设备。
我是新来的机器人。因此,如果可能的话给我的逻辑(的方式来完成的任务)。
如果可能的话然后给它的例子。

I want to send an image from one android device to one or multiple android devices. so which mechanism i should follow to send the image from one android device to another android device. I am new to android. so if possible then give me logic(way to complete the task). and if possible then give example of it..

推荐答案

看看SDK中WiFiDirectDemo样品(API等级14+)。这不正是你在找什么:
http://developer.android.com/resources/samples/WiFiDirectDemo/index.html

Take a look at the WiFiDirectDemo sample in the SDK (API level 14+). It does exactly what you are looking for: http://developer.android.com/resources/samples/WiFiDirectDemo/index.html

Wi-Fi直连是仅适用于运行ICS的设备。但是,套接字服务器/客户端code是通用的,可重复使用在Wifi网络也​​:

WiFi direct is only available for devices running ICS. However, the socket server/client code is generic and reusable over Wifi network also:

客户端:
<一href=\"http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/FileTransferService.html\" rel=\"nofollow\">http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/FileTransferService.html

服务器:
<一href=\"http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/DeviceDetailFragment.html\" rel=\"nofollow\">http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/DeviceDetailFragment.html
FileServerAsyncTask。

Server: http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/DeviceDetailFragment.html FileServerAsyncTask.

这篇关于如何发送和通过socket接收图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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