Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6660520
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: Android平台

2015-11-07 22:02:14



I'm kind of new to Java, Android and even Stackoverflow, sorry if my question is not well written.

I followed many guides online that showed me how to connect two devices using Wifi-direct. I managed to do this and now I just need to close the connection.

I have a C++ "server" peer and an Android "client" peer and for the client side I am using the Wifi-Direct Demo (linked below)

  • I create a Wifi-Direct group C++ side
  • From Android I search for servers
  • The user chooses the server
  • Socket connection
  • Transmission

Now I don't need the connection anymore, so I want to close it and immediately reconnect both devices to the normal Wifi.

If I try to launch the disconnect() function of the demo, it enter OnSuccess(), but the Wifi-Direct icon simply won't go away; Strangely, I can't find any guide at all on how to do this.

There is also another problem with my app... If I am connected, and I close the app, the Wifi-direct icon is still on and I can't connect to Internet using Wifi... I think the socket may still be in the TIME_WAIT status, but I'm not sure on how to check this...

Thank you in advance!

EDIT: some answer that I found useful, but do not show how to turn off Wifi-Direct:

https://android.googlesource.com/platform/development/+/master/samples/WiFiDirectDemo/




阅读(493) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~