android - Why is the client list empty when I connect as a client? -
i'm using android wi-fi direct service discovery. when connection info available, request group info if group formed. reason, when connect client, can group owner group, client list empty. when connect group owner, i'm able group owner , client list. when chat fragment, i'm trying display group owner , clients are. issue group owner device name seems blank, rest of info correct, address (i removed address lines). i've tried requesting group info in few different places, , i'm never able client list when connected client. switch chat fragment when receive service_connected
intent.
connecting client:
i/wfd_: wi-fi p2p connection changed i/wfd_: connected p2p network. requesting connection info i/wfd_: connection info available i/wfd_: wifip2pinfo: i/wfd_: group formed: true group owner: false group owner address: /192.168.49.1 i/wfd_: stopping service discovery i/wfd_: service discovery stopped i/wfd_: connected client i/wfd_: requesting group info i/wfd_commreceiver: device changed i/wfd_clientsockethandler: client socket thread running i/wfd_clientsockethandler: opening client socket i/system.out: [cds][dns] getallbynameimpl netid = 0 i/system.out: [socket][0] connection /192.168.49.1:4545;localport=34789(5000) i/system.out: [cds]connect[/192.168.49.1:4545] tm:5 i/wfd_: service discovery requests cleared i/wfd_: group info available i/wfd_: wifip2pgroup: i/wfd_: network name: direct-ig-blu clark 2 group owner: false group owner: device name: blu clark 2 status: unavailable client list empty. /system.out: [socket][/192.168.49.117:34789] connected i/wfd_clientsockethandler: client socket - true i/wfd_clientsockethandler: launching i/o handler i/wfd_commreceiver: service connected i/wfd_commreceiver: switching chat fragment i/wfd_: handlemessage() called
connecting group owner:
i/wfd_: wi-fi p2p connection changed i/wfd_: connected p2p network. requesting connection info i/wfd_: connection info available i/wfd_: wifip2pinfo: i/wfd_: group formed: true group owner: true group owner address: /192.168.49.1 i/wfd_: stopping service discovery i/wfd_: service discovery stopped i/wfd_: connected group owner i/wfd_ownersockethandler: group owner server socket started i/wfd_: requesting group info i/wfd_ownersockethandler: group owner server socket thread running i/wfd_: service discovery requests cleared i/wfd_commreceiver: device changed i/wfd_: group info available i/wfd_: wifip2pgroup: i/wfd_: network name: direct-xb-brendan blu group owner: true group owner: device name: status: unavailable client: device name: blu clark 2 status: connected i/wfd_commreceiver: service connected i/wfd_commreceiver: switching chat fragment i/wfd_ownersockethandler: launching i/o handler i/wfd_: handlemessage() called
code:
@override public void onconnectioninfoavailable(wifip2pinfo wifip2pinfo) { log.i(tag, "connection info available"); log.i(tag, "wifip2pinfo: "); log.i(tag, p2pinfotostring(wifip2pinfo)); this.groupformed = wifip2pinfo.groupformed; this.isgroupowner = wifip2pinfo.isgroupowner; if (wifip2pinfo.groupformed) { stopservicediscovery(); thread handler; if (wifip2pinfo.isgroupowner) { log.i(tag, "connected group owner"); try { handler = new ownersockethandler(this.gethandler()); handler.start(); } catch (ioexception e) { log.e(tag, "failed create server thread - " + e.getmessage()); return; } } else { log.i(tag, "connected client"); handler = new clientsockethandler(this.gethandler(), wifip2pinfo.groupowneraddress); handler.start(); } log.i(tag, "requesting group info"); // requests peer-to-peer group information wifip2pmanager.requestgroupinfo(channel, new wifip2pmanager.groupinfolistener() { @override public void ongroupinfoavailable(wifip2pgroup wifip2pgroup) { log.i(tag, "group info available"); if (wifip2pgroup != null) { log.i(tag, "wifip2pgroup:"); log.i(tag, p2pgrouptostring(wifip2pgroup)); wifidirecthandler.this.wifip2pgroup = wifip2pgroup; } else { log.w(tag, "group null"); } localbroadcastmanager.sendbroadcast(new intent(action.service_connected)); } }); } else { log.w(tag, "group not formed"); } localbroadcastmanager.sendbroadcast(new intent(action.device_changed)); }
according 1 of wi-fi direct contributors, group client cannot see list of other clients. group owner have keep track of , inform group clients.
https://groups.google.com/forum/#!topic/wi-fi-direct/ox83pka1ilw
Comments
Post a Comment