John Leehey
John Leehey

Reputation: 22240

New 4.0 API: WifiP2pManager... how to transmit data?

In the new Ice Cream Sandwich SDK (4.0), there is a new section of the API for creating p2p connections over wifi. There is plenty of information in the WifiP2pManager class on how to connect and discover peers and peer groups, but very little detail on how to send data after a connection is established. It says:

The connection info WifiP2pInfo contains the address of the group owner groupOwnerAddress and a flag isGroupOwner to indicate if the current device is a p2p group owner. A p2p client can thus communicate with the p2p group owner through a socket connection.

I don't have a ton of experience with creating socket connections. What would be needed for a peer to send data, and for a peer group owner to receive it, just from the WifiP2pInfo or connection methods?

Upvotes: 0

Views: 2974

Answers (1)

John Leehey
John Leehey

Reputation: 22240

Being new, there isn't a lot of information on this, but the sample application from the android developers resources is a fantastic demo project that gave me everything I needed to know.

WiFiDirectDemo Project

With the WiFiP2pInfo, you can open a socket for data transmission. It has an example for sending files in the demo.

Upvotes: 2

Related Questions