πŸ”Œ Non-blocking TCP socket layer, with event-driven server and client.

Overview
Comments
  • swift build error on armv7l debian

    swift build error on armv7l debian

    in trying to add your library as a swift package, i cannot successfully $ swift build. i'm not sure if this is an issue due to the architecture i'm using, or if i'm doing something else completely innane. in any case, just wanted to report it. thanks in advance for any assistance!

    -- mack

    here is the output: root@chip:~/macks-projects/blink/blink-package/Sources# swift build Compile Swift Module 'SocksCore' (14 sources) /root/macks-projects/blink/blink-package/Packages/Socks-0.7.0/Sources/SocksCore/FDSet.swift:34:20: error: cannot assign value of type '(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)' to type '(__fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask)' (aka '(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)') set.__fds_bits = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <unknown>:0: error: build had 1 command failures error: exit(1): /root/macks-projects/pre-built-swift/swift-3.0/usr/bin/swift-build-tool -f /root/macks-projects/blink/blink-package/.build/debug.yaml

    opened by mackhowell 7
  • Failure to compile on Raspberry Pi

    Failure to compile on Raspberry Pi

    FD_ZERO is apparently defined as 32 bytes on an R/Pi 3:

    uname -a
    Linux ubuntu 4.4.0-1029-raspi2 #36-Ubuntu SMP Wed Oct 19 14:38:48 UTC 2016 armv7l armv7l armv7l GNU/Linux
    

    I get the following compile error on an R/Pi 3 running latest version of ubuntu:

    swift build
    Cloning https://github.com/czechboy0/Redbird.git
    HEAD is now at bb2ac0e Updated Swift to 08-15 (#38)
    Resolved version: 0.10.0
    Cloning https://github.com/czechboy0/Socks.git
    HEAD is now at 460dc7f Merge pull request #73 from vapor/gm
    Resolved version: 0.12.2
    Compile Swift Module 'SocksCore' (14 sources)
    /home/ubuntu/BlueCycles/linux/Packages/Socks-0.12.2/Sources/SocksCore/FDSet.swift:34:20: error: cannot assign value of type '(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)' to type '(__fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask)' (aka '(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)')
      set.__fds_bits = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <unknown>:0: error: build had 1 command failures
    error: exit(1): /usr/bin/swift-build-tool -f /home/ubuntu/BlueCycles/linux/.build/debug.yaml
    
    opened by rvsrvs 6
  • rare `UnsafeMutablePointer.initializeFrom` error

    rare `UnsafeMutablePointer.initializeFrom` error

        let _raw: UnsafeMutablePointer<sockaddr_storage>
        var raw: UnsafeMutablePointer<sockaddr> {
            return UnsafeMutablePointer<sockaddr>(_raw)
        }
    
        init(raw: UnsafeMutablePointer<sockaddr_storage>) {
            let ptr = UnsafeMutablePointer<sockaddr_storage>.init(allocatingCapacity: 1)
            >>>>>> ptr.initializeFrom(raw, count: 1)
            self._raw = ptr
        }
    
    fatal error: UnsafeMutablePointer.initializeFrom non-following overlapping range
    

    This happens every once in a while. I can't reproduce, but putting it here in case anyone finds more information about it.

    bug 
    opened by tanner0101 6
  • add several podspec for CocoaPods support

    add several podspec for CocoaPods support

    it's make me feel sad that I can't use this library directly in my iOS App with swiftpm, so I have create several podspec files, make it's easy to use this lib in their CocoaPods project.

    opened by codetalks-new 5
  • Cocoapods support

    Cocoapods support

    Hello there! You library is awesome but it's hard to use it in big iOS project without dependency manager support. Do you have plans to add Cocoapods support?

    opened by danshevluk 5
  • add readn func to TCPReadableSocket

    add readn func to TCPReadableSocket

    as TCP is a stream protocol, At many times, one data packet may be send within different segment. so a readn func would help us a lot. advices need to improve it.

    opened by codetalks-new 5
  • Various improvements

    Various improvements

    Improved performance

    Previously, all bytes received were passed trough an map operation that is not required, since the bytes are already UInt8. This change improves performance for large transfers considerably.

    Improves https://github.com/vapor/vapor/issues/734

    Improved cleanup and safety

    • TCPInternetSocket and UDPInternetSocket now close their descriptors on deinit
    • Additional calls to close() don't try to close the file descriptor anymore
    • Attempts to use a closed TCPInternetSocket or UDPInternetSocket now throw to prevent using a descriptor that may already be used otherwise

    Improved testing

    • WatchingTests are now run under Linux, too
    • WatchingTests should not fail anymore
    • Added tests for releasing and using closed sockets
    opened by andreasley 5
  • Socks times out when receiving all data where the `messagedata.count % 512 == 0`

    Socks times out when receiving all data where the `messagedata.count % 512 == 0`

    extension TCPReadableSocket {
    
        public func recv(maxBytes: Int = BufferCapacity) throws -> [UInt8] {
            let data = Bytes(capacity: maxBytes)
            let flags: Int32 = 0 //FIXME: allow setting flags with a Swift enum
            let receivedBytes = socket_recv(self.descriptor, data.rawBytes, data.capacity, flags)
            guard receivedBytes > -1 else { throw SocksError(.readFailed) }
            let finalBytes = data.characters[0..<receivedBytes]
            let out = Array(finalBytes.map({ UInt8($0) }))
            return out
        }
    
        public func recvAll() throws -> [UInt8] {
            var buffer: [UInt8] = []
            let chunkSize = 512
            while true {
                let newData = try self.recv(maxBytes: chunkSize)
                buffer.append(contentsOf: newData)
                if newData.count < chunkSize {
                    break
                }
            }
            return buffer
        }
    }
    

    Here at the line if newData.count < chunkSize every user will get a timeout when the last chunk received (newData) has a count of 512 bytes. This has been haunting us for days until we realised the socket library might be at fault.

    opened by Joannis 5
  • WebSocket and Socks

    WebSocket and Socks

    So I've started up a TCP server with socks and a TCP Client with straight Javascript.

    I get the initial request from my javascript client to my Socks server, but however I have no idea what to send back to the javascript client to allow it to upgrade and begin sending and receiving data. I've had this issue with various WebSocket clients of not being able to complete the connection...

    In Socks what should I do? my server is basically the sample code you've provided, and the client is the sample code provided here: http://www.tutorialspoint.com/html5/html5_websocket.htm

    ironically, I do get the disconnect message when I turn off my server.

    I also tried using the Socks TCPSocket Client and I get roughly the same issue, I can send the first message, and then nothing works after that.

    opened by PhilipHayes 5
  • Send/receive timeouts

    Send/receive timeouts

    Added sending and receiving timeout options to SocketOptions. This allows callers to specify timeouts on a socket. Please note that 0 timeout means wait forever, not return immediately, so be careful when integrating with other libraries, some use -1 as wait forever, which is an invalid value here.

    /cc @tannernelson

    Fixes #30, #48

    opened by czechboy0 4
  • Response not received

    Response not received

    In iOS mobile app, when mobile/cellular data and WiFi connections - both are Enabled and App tries to perform socket operation on WiFi connected device, app able to create connection and send data successfully but it does not able to receive response and throws exception: "The operation couldn’t be completed. (appName.SocketsError error 1.)"

    opened by kartikpatel211 3
  • Build fails when standalone

    Build fails when standalone

    The swift build fails with Fatal error: Duplicate values for key: 'Async': file /BuildRoot/Library/Caches/com.apple.xbs/Binaries/swiftlang/install/TempContent/Objects/BNI_assert_lightweight/swift-macosx-x86_64/stdlib/public/core/8/HashedCollections.swift, line 8108

    The complete output is this: Fetching https://github.com/vapor/core.git Fetching https://github.com/vapor/async.git Fetching https://github.com/apple/swift-nio.git Fetching https://github.com/apple/swift-nio-zlib-support.git Cloning https://github.com/apple/swift-nio.git Resolving https://github.com/apple/swift-nio.git at 1.9.2 Cloning https://github.com/vapor/async.git Resolving https://github.com/vapor/async.git at 1.0.0-rc.1.1 Cloning https://github.com/vapor/core.git Resolving https://github.com/vapor/core.git at 3.4.1 Cloning https://github.com/apple/swift-nio-zlib-support.git Resolving https://github.com/apple/swift-nio-zlib-support.git at 1.0.0 Fatal error: Duplicate values for key: 'Async': file /BuildRoot/Library/Caches/com.apple.xbs/Binaries/swiftlang/install/TempContent/Objects/BNI_assert_lightweight/swift-macosx-x86_64/stdlib/public/core/8/HashedCollections.swift, line 8108 Illegal instruction: 4 I was trying to investigate why swift package update was stuck on this dependency of vapor.

    opened by eutampieri 1
Releases(2.2.3)
Owner
Vapor Community
Packages maintained by Vapor's community members.
Vapor Community
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

Kitura 1.3k Jan 3, 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
Reactive WebSockets - A lightweight abstraction layer over Starscream to make it reactive.

RxWebSocket Reactive extensions for websockets. A lightweight abstraction layer over Starscream to make it reactive. Installation RxWebSocket is avail

FlΓ‘vio Caetano 57 Jul 22, 2022
SwiftWebSocket - Conforming WebSocket (RFC 6455) client library for iOS and Mac 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 Jan 5, 2023
SSL/TLS Add-in for BlueSocket using Secure Transport and OpenSSL

BlueSSLService SSL/TLS Add-in framework for BlueSocket in Swift using the Swift Package Manager. Works on supported Apple platforms (using Secure Tran

Kitura 87 Nov 15, 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 Jan 4, 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
πŸ”Œ 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
MQTTNIO - Non-blocking, event-driven Swift client for MQTT build on SwiftNIO

This library has support for WebSocket connections and TLS. It runs on all platforms Swift NIO runs on (e.g. macOS, iOS, Linux, etc.).

Steven Roebert 41 Dec 23, 2022
A non gesture blocking, non clipping by default custom scroll view implementation with example code

A non gesture blocking, non clipping by default custom scroll view implementation with example code

Marco Boerner 10 Dec 6, 2022
OpenSwiftUIViews - A non gesture blocking, non clipping by default custom scroll view implementation with example code.

OpenSwiftUIViews - A non gesture blocking, non clipping by default custom scroll view implementation with example code.

Marco Boerner 11 Jan 4, 2023
JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available.

JustLog JustLog takes logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support f

Just Eat 509 Dec 10, 2022
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
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework

Serverside non-blocking IO in Swift Ask questions in our Slack channel! Lightning (formerly Edge) Node Lightning is an HTTP Server and TCP Client/Serv

SkyLab 316 Oct 6, 2022
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework

Serverside non-blocking IO in Swift Ask questions in our Slack channel! Lightning (formerly Edge) Node Lightning is an HTTP Server and TCP Client/Serv

SkyLab 316 Oct 6, 2022
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework

Serverside non-blocking IO in Swift Ask questions in our Slack channel! Lightning (formerly Edge) Node Lightning is an HTTP Server and TCP Client/Serv

SkyLab 316 Oct 6, 2022
A script for focusing on work, blocking non-work stuff.

A script for focusing on work, blocking non-work stuff. The idea is to forbid mindless app/website context-switching while you're focused. Once you're

null 3 Jan 23, 2022
An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.

An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard. Installation CocoaPods PTEv

Aman Taneja 36 Oct 5, 2022
Event management iOS app for organizers using Open Event Platform

Open Event Organizer iOS App Event management app for organizers using Open Event Platform Roadmap Make the app functionality and UI/UX similar to the

FOSSASIA 1.5k Dec 29, 2022
Ease is an event driven animation system that combines the observer pattern with custom spring animations as observers

Ease is an event driven animation system that combines the observer pattern with custom spring animations as observers. It's magic. Features Animate a

Robert-Hein Hooijmans 1.3k Nov 17, 2022