I want to transfer data with WifiDirect.
So I connected two devices with it and opened a SeverSocket on one device. When I want to connect to this ServerSocket from the other device by clicking a button in an activity (there I open a socket with the ip of the group owner, the server) I get: "Failed to open Socket Connection".
When I open an IntentService and execute the code there instead of executing the code in buttenClicked method in the activity it works perfectly.
Why is it not possible to open the Socket in an Activity, but in an IntentService?