4

I'm an old-school c/c++ programmer new to the Xcode IDE, tasked with creating an app for iOS that can receive data from an IPv4 multicast address. Since Swift 3 doesn't have an API for joining to a multicast address or binding to a port, I need to embed Objective-C code in the Swift code.

I have found a number of ways to do it with an asynch UDP socket, but when I reference either CocoaAsyncSocket.h (or GCDAsyncUdpSocket.h), I get an error "Module 'CocoaAsyncSocket' not found." Indeed, if I do a file search, I come up dry.

I don't see that Objective-C or its libraries can be downloaded from Apple, and they didn't come along when I downloaded Xcode 8.3.2, nor can I locate an Open Source version. Can anyone provide some pointers? Thanks!

bob quinn
  • 541
  • 5
  • 17
  • 1
    https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/UsingSocketsandSocketStreams.html CocoaAsyncSocket is most probably third party library. from Swift it is very easy to use any C API, as you did as old-school c programmer – user3441734 May 11 '17 at 20:05

1 Answers1

2

CocoaAsyncSocket

UDP Server and Client in Swift

Using the BlueSocket framework to create an echo server

Multi-Client echo server with the BlueSocket framework and libdispatch

BlueSocket pure Swift ...

Minimalistic Multi-Client EchoSerwer written in Swift (no external framework required)

enter image description here

Minimalistic Echo UDP Server written in Swift (no external framework required)

enter image description here

user3441734
  • 16,722
  • 2
  • 40
  • 59