Giter VIP home page Giter VIP logo

socket.swift's People

Contributors

orkhanalikhanov avatar raymondjavaxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

socket.swift's Issues

Getting connection error using swift 4

Hello,

I implemented the code in my demo project but it seems that I am making some mistake and hence I am getting the connection error saying that connection refused. I tried with the port and the IP address. Could you please suggest me how can I solve this? Below I am sending you the code which I have implemented.

Client Side:
do {
let client = try Socket(.inet, type: .stream, protocol: .tcp) // create client socket
do {
try client.connect(port: 8080, address: "192.168.1.50")
}
catch {
print(error)
}
var buffer = [UInt8](repeating: 0, count: helloBytes.count) // allocate buffer
let numberOfReadBytes = try client.read(&buffer, size: helloBytes.count)
print(numberOfReadBytes == helloBytes.count) // true
print(buffer == helloBytes) // true
client.close()
}
catch {
print(error)
}
Server Side
do {
let server = try Socket(.inet, type: .stream, protocol: .tcp) // create server socket
do {
try server.set(option: .reuseAddress, true) // set SO_REUSEADDR to 1
}
catch {
print(error)
}

        do {
            try server.bind(port: 8080, address:"192.168.1.88" ) // bind 'localhost:8090' address to the socket
        }
        catch {
            print(error)
        }
        
        do {
            try server.listen() // allow incoming connections
        }
        catch {
            print(error)
        }

// server.close()
let clientAtServerside = try server.accept() // accept client connection
try clientAtServerside.write(helloBytes) // sending bytes to the client
clientAtServerside.close()
}
catch {
print(error)
}

Please kindly provide the solution for this.

use it in app extension failed!

Extension com.ribencong.blockchainPipe.TunProxy died unexpectedly
[TunProxy:75295] SyscallError: setpriority(PRIO_DARWIN_ROLE, 75295, 3): No such process
[TunProxy:75295] Remove assertion: <BKProcessAssertion: 0x100d7d6c0; "com.apple.extension.session" (extension:inf); id:โ€ฆ85104422BD2F>
-CMSessionMgr- CMSessionMgrHandleApplicationStateChange: CMSession: Client com.ribencong.blockchainPipe.TunProxy with pid '75295' is now Background Running. Background entitlement: NO LongFormVideoApp: NO
1177: pid 75295(TunProxy)

cannot compile in Ubuntu 16.04

Hello,

the project seem to not be able to compile in ubuntu 16.04, using Swift 4.1
libressl cannot be installed.
swift build report several error around CLibreSSL

Listen for client message

Hi and thanks for your great job.
I have a nodejs client which sends messages to the server part. I use your work to create the server part. I need to listen incoming messages in my swift app. With delegate? Thanks a lot in advance!

cellular radio activitation

apple documentation reads that POSIX sockets will not activate the cellular radio... but I read things on stackoverflow saying it does (users had succesfully accomplished it)... then another user said the radio died after a little bit, with others being surprised.

do you have any final word on this, given this library exists? thanks!

Generating the TLS certificate at runtime

Hi, Thank you very much for the libraries Socket.swift and HTTP.swift.

I need to generate the certificate used by the HTTP server (and thus the TLS.swift file used in Socket.swift) at runtime. That is to say I need to generate a new certificate everytime the app is launched and I start up the server.

Do you know of any way that this can be achieved on iOS?

I have searched far and wide and it seems most people end up shipping a copy of OpenSSL in their app to do this. I am guessing that if I ended up doing this, then I would need export compliance and sign off from the US government / Apple to do this.

SocketError 4: Interrupted system call

Until now it worked perfectly for me, but since the iOS 15.4 version I can't connect to the TCP server.

The error is: SocketError 4: Interrupted system call

(If I try with an iPhone with iOS 15.2, it works)

Ubuntu 16.04 does not build

i get a warning if i try to build my project

warning: you may be able to install libtls using your system-packager:
     apt-get install libressl

installing apt-get install libressl does not find the package

errors on building
.build/checkouts/CLibreSSL/clibressl.h:4:10: error: 'tls.h' file not found
.build/checkouts/Socket.swift/Sources/TLS.swift:12:12: error: could not build C module 'CLibreSSL'

TestFlight Upload Failure with Xcode 15 & Fastlane Due to Missing CFBundleVersion in SocketSwift.xcframework

Description

I've encountered an upload issue to TestFlight using Fastlane's pilot tool in combination with Xcode 15. The error occurs specifically with the SocketSwift.xcframework included in my application. During the upload process, asset validation fails with an error indicating that the Info.plist within SocketSwift.xcframework is missing the required CFBundleVersion key.

Detailed Error Output

Asset validation failed (90056) This bundle Payload/<my-app.app>/Frameworks/SocketSwift.framework is invalid. 
The Info.plist file is missing the required key: CFBundleVersion. 
Please find more information about CFBundleVersion at 
https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion (ID: 5f353f23-4add-481b-8e2c-2c443a55dc26)

not getting adress?

how to take socket connected to server socket adress?

func echoService(client: TCPClient) {
    print("Newclient from:\(client.address)[\(client.port)]")    // I need that Like code ! 
    var d = client.read(1024*10)
    client.send(data: d!)
    client.close()
}

func testServer() {
    let server = TCPServer(address: "127.0.0.1", port: 8080)
    switch server.listen() {
      case .success:
        while true {
            if var client = server.accept() {
                echoService(client: client)
            } else {
                print("accept error")
            }
        }
      case .failure(let error):
        print(error)
    }
}

Getting the remote socket address

Thanks for this great package. I'm using this on Linux.

What's the best way to get the remote socket address after the accept returns?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.