Amit
Amit

Reputation: 13364

Which Socket API to use android.net or java.net for UDP Communication in Android?

I need UDP Communication between my device and/or an another android device / iPhone / Server etc.

While exploring the android developer site I found that their are two packages java.net (plain Java Classes) and android.net(Looks like they are android specific implementations). Which set of classes I should use so that I don't get any problem while connecting to other devices. Which is the most efficient way to provide UDP socket communication in Android. I saw Android UDP Communication but that also looks incomplete.

Upvotes: 0

Views: 528

Answers (2)

Phani
Phani

Reputation: 5427

For UDP, Android relies on java.net packages it self. You should use Java.

Upvotes: 1

Santosh
Santosh

Reputation: 17903

You can use standard java.net.UserDatagramSocket/Packet. Here is the official documentation and example.

Upvotes: 0

Related Questions