SwifterSockets is a collection of utility functions that wrap around the UNIX socket functions so that usage from within Swift is easier. In the recent versions, it has evolved to include a layer of abstraction that allows even easier implementation of servers and client connections.

It is of course used in Swiftfire, but can equally well be used on its own in other projects.

SwifterSockets is hosted on GitHub

The reference manual is here

About socket operations

While SwifterSockets shields a Swift application from the (beauty) of the UNIX calls, knowledge of the underlying networking technology is necessary.

The best thing to do is to read Beej’s Guide to Network Programming. It is an easy and entertaining read that will prepare you for most of the things that network programming can throw at you. At least you will then have the basic understanding to try and find out what went wrong… 😉

Another important aspect of network programming is multithreading. Brush up on that as well, if necessary.

A series of blog posts about network programming have been posted while SwifterSockets was being created:

Part 1: Getaddrinfo

Part 2: Socket and getsockopt

Part 3: Bind & Listen

Part 4: Software design considerations

Part 5: Accept

Part 6: Select and recv

Part 7: Client side considerations

Part 8: Server side considerations

The last two of these deal with choosing the right data transfer techniques.