There are a number of network APIs and frameworks provided by Apple. The newest being
Network.framework, it allows us to work on the transport layer of the network stack. This gives us access to lower levels of the network stack than what most applications will need. But sometimes that is even higher than what we need. Maybe we need to interoperate directly with native sockets.
There are not many examples of how to use BSD sockets in Swift, so I put together an example to create a server and a client using BSD sockets in Swift. You can check the original article here:
It is not common to have to do that type of low-level networking, but when you find yourself in need of an example you'll be happy to have one.
I hope it's useful. Let me know what you think. Also, if you know someone that might find it interesting, please share it.