UDP broadcast send and receive (Ios+asyncudpsocket) next

Source: Internet
Author: User

Send and receive UDP broadcasts from the previous C #

Http://www.cnblogs.com/JimmyBright/p/4637090.html

Using Asyncudpsocket to process UDP messages in iOS is very convenient

Preparatory work:

Find Cocoaasyncsocket on GitHub, download it, copy the AsyncUdpSocket.h and ASYNCUDPSOCKET.M files to your project, and no other files are needed. Copy to the SWIFT environment will automatically prompt to create the bridge file, click on the confirmation.

Send UDP:

The above code broadcasts the message "Hello worldxxxx" to the LAN, and has been tested to successfully receive the broadcast message in the UDP broadcast of the previous C #

Receive UDP:

The above mentioned C # version of UDP, every 1 seconds to send an IP out, tested in iOS can successfully receive the IP, of course, the above code can only be received once, if you want to keep listening, you need to create a loop.

UDP broadcast send and receive (Ios+asyncudpsocket) next

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.