How to send a string in a UDP socket in iOS7?

Michal Shatz picture Michal Shatz · Jan 18, 2014 · Viewed 9.7k times · Source

I am trying to send a simple string over UDP in my iOS7 app to a known IP and could not find a simple explanation and sample code on how to do that. There is plenty out there about TCP but not so much about UDP and it has to be UDP in my case.

Answer

Martin R picture Martin R · Jan 18, 2014

You could use https://github.com/robbiehanson/CocoaAsyncSocket, which is an Objective-C wrapper for TCP and UDP connections. It also contains sample code for TCP and UPD clients and servers.