A protocol oriented wrapper around the POSIX socket API written in Swift
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ChatServer
SocketWrapper.xcodeproj
SocketWrapper
client
server
.gitignore
LICENSE
README.md

README.md

SocketWrapper

This is a POSIX socket API wrapper written in Swift.

It is intended for testing networking stuff in Little Snitch where exact control over the low-level socket API calls is important. Also, we wanted to try out some concepts in Swift, especially in regard to protocol oriented programming.

It is not intended as a general purpose networking library that makes your life as an app developer easier. There are other things for that out there.

A presentation of this code and its implementation was first shown to the public at a CocoaHeads meetup in Vienna on 2016-03-10.

TODO

Here’s a very incomplete list of things that could be added or changed:

  • Implement support for other protocols than TCP. The low-level Socket struct probably doesn’t need any changes for that, but the higher-level SocketType sub-protocols don’t expose initializers for that.
  • getaddrinfo() returns a linked list of results and only the very first one is used for connect()/accept(). That list should probably be traversed until those calls actually succeed.