A collection of socket utilities in pure Swift

Overview

SwifterSockets

A collection of socket utilities in pure Swift

SwifterSockets is part of the Swiftfire webserver project.

The Swiftfire website

The reference manual

SwifterSockets is also used in our PortSpy application in the App Store. Buyers of PortSpy get the complete sources of the project (Xcode project) used to build the App.

If you need secure connections, check out SecureSockets which is build on top of SwifterSockets (and OpenSSL).

If you are new to socket programming, check out our blog series which starts here

Features

  • Shields the Swift application from the complexity of the Unix socket calls.
  • Directly interfaces with the POSIX calls using:
    • connectToTipServer
    • tipTransfer
    • tipReceiverLoop
    • tipAccept
    • setupTipServer
  • Implements a framework on top of the POSIX calls with:
    • Connection (class)
    • connectToTipServer (returns a connection)
    • TipServer (class, produces connections)
  • Includes replacements for the FD_SET, FD_CLR, FD_ZERO and FD_ISSET macro's.
  • Builds as a library using the Swift Package Manager (SPM)

Installation

SwifterSockets can be used by the Swift Package Manager. Just add it to your package manifest as a dependency.

Alternatively you can clone the project and generate a Xcode framework in the following way:

  1. First clone the repository and create a Xcode project:

     $ git clone https://github.com/Balancingrock/SwifterSockets
     $ cd SwifterSockets
     $ swift package generate-xcodeproj
    
  2. Double click that project to open it. Once open set the Defines Module to 'yes' in the Build Settings before creating the framework. (Otherwise the import of the framework in another project won't work)

  3. In the project that will use SwifterSockets, add the SwifterSockets.framework by opening the General settings of the target and add the SwifterSockets.framework to the Embedded Binaries.

  4. In the Swift source code where you want to use it, import SwifterSockets at the top of the file.

Version history

No new features planned. Updates are made on an ad-hoc basis as needed to support Swiftfire development.

1.1.3

  • Reduced suported macOS platform to v10_10.

1.1.2

  • Added platforms, swift version and LICENSE file.

1.1.1

  • Added linux compatibility

1.1.0

  • Removed SocketAddress.swift (due to warnings in Swift 5.2)
  • Switched to Swift.Result instead of BRUtils.Result
  • Introduced SwifterSocketsResult
  • Removed now superfluous BRUtils dependency

1.0.2

  • Documenation updates

1.0.1

  • Fixed website link in header

1.0.0

  • Restructured for Swiftfire 1.0.0
You might also like...
Chronos is a collection of useful Grand Central Dispatch utilities
Chronos is a collection of useful Grand Central Dispatch utilities

Chronos is a collection of useful Grand Central Dispatch utilities. If you have any specific requests or ideas for new utilities, don't hesitate to create a new issue.

A collection of operators and utilities that simplify iOS layout code.

Anchorage A lightweight collection of intuitive operators and utilities that simplify Auto Layout code. Anchorage is built directly on top of the NSLa

Chronos is a collection of useful Grand Central Dispatch utilities.
Chronos is a collection of useful Grand Central Dispatch utilities.

Chronos is a collection of useful Grand Central Dispatch utilities. If you have any specific requests or ideas for new utilities, don't hesitate to create a new issue.

Chronos is a collection of useful Grand Central Dispatch utilities.
Chronos is a collection of useful Grand Central Dispatch utilities.

Overview Chronos is a collection of useful Grand Central Dispatch utilities. If you have any specific requests or ideas for new utilities, don't hesit

A collection of common SwiftUI and UIKit utilities.

KippleUI A collection of common SwiftUI and UIKit utilities. ⚠️ The code in this library has been made public as-is for the purposes of education, dis

A collection of common diagnostics and debugging utilities.

KippleDiagnostics A collection of common diagnostics and debugging utilities. ⚠️ The code in this library has been made public as-is for the purposes

Pure makes Pure DI easy in Swift.

Pure Pure makes Pure DI easy in Swift. This repository also introduces a way to do Pure DI in a Swift application. Table of Contents Background Pure D

Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux.

BlueSocket Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux. Prerequisites Swift Swift Open Source swift-4.0

Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux.

BlueSocket Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux. Prerequisites Swift Swift Open Source swift-5.1

Sweet-swift - Make Swift Sweet by Gracefully Introducing Syntactic Sugar, Helper Functions and Common Utilities

Sweet Swift Make Swift Sweet by Gracefully Introducing Syntactic Sugar, Helper F

Swift async/await based socket

Socket Swift async/await based socket library Introduction This library exposes an idiomatic Swift API for interacting with POSIX sockets via an async

Swift utilities for running commands.

Swift Commands Swift utilities for running commands. The Commands module allows you to take a system command as a string and return the standard outpu

A starting point to create CLI utilities with swift

cli tuist template A starting point to create CLI utilities with swift Installation Just create a Tuist folder and a Templates folder inside it. Creat

Checkout API Client, Payment Form UI and Utilities in Swift
Checkout API Client, Payment Form UI and Utilities in Swift

Frames iOS Requirements iOS 10.0+ Xcode 12.4+ Swift 5.3+ Documentation Further information on using the Frames SDK is available in the integration gui

A small set of utilities to make working with CoreData and Swift a bit easier.

SuperRecord =================== SUPPORTS SWIFT 2.0 from Version = 1.4 ** SUPPORTS SWIFT 1.2 from Version = 1.3 Both iOS and WatchOS A Swift CoreData

🔌  Non-blocking TCP socket layer, with event-driven server and client.
🔌 Non-blocking TCP socket layer, with event-driven server and client.

Original authors Honza Dvorsky - http://honzadvorsky.com, @czechboy0 Matthias Kreileder - @matthiaskr1 At the request of the original authors, we ask

🔌  Non-blocking TCP socket layer, with event-driven server and client.
🔌 Non-blocking TCP socket layer, with event-driven server and client.

Original authors Honza Dvorsky - http://honzadvorsky.com, @czechboy0 Matthias Kreileder - @matthiaskr1 At the request of the original authors, we ask

Socket.io iOS and OSX Client compatible with v1.0 and later
Socket.io iOS and OSX Client compatible with v1.0 and later

SocketIO-Kit ⚠️ This project is no longer maintained. Please use the official framework Socket.IO-Client-Swift. SocketIO-Kit is a Socket.io iOS client

Asynchronous socket networking library for Mac and iOS

CocoaAsyncSocket CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for macOS, iOS, and tvOS. The classes are described

Comments
Releases(1.0.0)
  • 1.0.0(Aug 18, 2019)

    Swiftfire -and all its supporting packages- have been issued in their release 1.0.0

    SwifterSockets has undergone some file-renaming and some reorganization. Otherwise the functionality itself is unchanged.

    Source code(tar.gz)
    Source code(zip)
  • 0.11.0(Apr 9, 2018)

  • 0.10.11(Apr 5, 2018)

  • 0.10.10(Mar 31, 2018)

  • 0.10.9(Nov 25, 2017)

  • 0.10.8(Jun 8, 2017)

    The BRUtils package has been upgraded to 0.5.0. In 'SwifterSockets.Connection.swift' the methods incrementUsageCount and decrementUsageCount have been made public. (To help in supporting very large HTTP bodies by Swiftfire).

    Source code(tar.gz)
    Source code(zip)
  • 0.10.7(May 24, 2017)

    Two bugs were fixed:

    • A crash that would occur when a connection object received data just (milli seconds) before it was closed.
    • A bug that would cause connection objects to go missing when a connection was accepted, but no data was ever received. This was a fairly common occurrence and would result in a non-response server.

    Unfortunately this necessitated the change of 1 interface in Connection.swift: 'receiverData' is now supplanted by 'processReceivedData'.

    Source code(tar.gz)
    Source code(zip)
  • 0.10.6(May 2, 2017)

    Bugfixes:

    • Updated references captured by closures
    • In 'transmitterClosed' the interface is immediately nilled to prevent SSL errors on closing
    • Added closing of the socket on 'transmitterClosed'

    Added functionality:

    • Sorting of connections in the connection pool

    API changes:

    • Renamed 'abortConnection' to 'connectionWasClosed'
    Source code(tar.gz)
    Source code(zip)
  • 0.10.5(Apr 9, 2017)

    Added "affectInactivityDetection" parameters to Connection - transfer functions. This allows the transmission of data in the inactivity detection action itself. The parameter is by default set to "true" so no code updates are necessary.

    Source code(tar.gz)
    Source code(zip)
  • 0.10.4(Apr 9, 2017)

Owner
Rien
Balancingrock has over 30 years of SW engineering experience. From Assembly and Ada to Swift.
Rien
Socket.IO-client for iOS/OS X.

Socket.IO-Client-Swift Socket.IO-client for iOS/OS X.

Socket.IO 4.9k Jan 1, 2023
🔌 Non-blocking TCP socket layer, with event-driven server and client.

Original authors Honza Dvorsky - http://honzadvorsky.com, @czechboy0 Matthias Kreileder - @matthiaskr1 At the request of the original authors, we ask

Vapor Community 574 Dec 7, 2022
Websockets in swift for iOS and OSX

Starscream is a conforming WebSocket (RFC 6455) library in Swift. Features Conforms to all of the base Autobahn test suite. Nonblocking. Everything ha

Dalton 7.5k Dec 29, 2022
Fast Websockets in Swift for iOS and OSX

SwiftWebSocket Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX. SwiftWebSocket passes all 521 of the Autobahn's fuzzing tests, incl

Josh Baker 1.5k Dec 27, 2022
WebSocket(RFC-6455) library written using Swift

DNWebSocket Object-Oriented, Swift-style WebSocket Library (RFC 6455) for Swift-compatible Platforms. Tests Installation Requirements Usage Tests Conf

Gleb Radchenko 36 Jan 29, 2022
AQMonitoring - Air Quality Monitoring App to see live AQI and city data/graph in Swift with WebSocket and MVVM architecture

AQMonitoring Air Quality Monitoring App to see live AQI and city data/graph in S

Kajal Nasit 0 Jan 9, 2022
Starscream is a conforming WebSocket (RFC 6455) library in Swift.

Starscream is a conforming WebSocket (RFC 6455) library in Swift. Features Conforms to all of the base Autobahn test suite. Nonblocking. Everything ha

Dalton 7.5k Jan 7, 2023
Socket.IO - Socket.IO client for iOS/OS X.

Socket.IO - Socket.IO client for iOS/OS X.

Socket.IO 4.9k Jan 9, 2023
DispatchSource based socket framework written in pure Swift

SwiftDSSocket Overview SwiftDSSocket is a purely swift based asynchronous socket framework built atop DispatchSource. Function signatures are pretty m

Yi Huang 65 Nov 15, 2022
DispatchSource based socket framework written in pure Swift

SwiftDSSocket Overview SwiftDSSocket is a purely swift based asynchronous socket framework built atop DispatchSource. Function signatures are pretty m

Yi Huang 65 Nov 15, 2022