V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
banxi1988
V2EX  ›  iDev

vapor/socks: 一个纯 Swift 的 Socket 库: 支持 TCP, UDP, Server, Client, Linux , OS X

  •  
  •   banxi1988 ·
    banxi1988 · 2017-02-06 21:14:39 +08:00 · 3938 次点击
    这是一个创建于 2607 天前的主题,其中的信息可能已经有所发展或是发生改变。
    https://github.com/vapor/socks
    前段时间要使用 TCP 通信,在我自己想基于 Socket C 库封装一个 TCP 库时,发现了 Socks
    它的代码质量不错.使用上手也很有 Swift Style.
    另外如果想了解 Swift 与 C API 的互操作性, 也可以通过这个库多加了解.

    附一个简单的使用测试图:

    http://wx1.sinaimg.cn/mw690/6a15a2e2ly1fch22t7f52j21aw0f043z.jpg
    2 条回复    2017-08-17 11:15:28 +08:00
    beimenjun
        1
    beimenjun  
       2017-08-17 00:54:04 +08:00
    感谢分享
    banxi1988
        2
    banxi1988  
    OP
       2017-08-17 11:15:28 +08:00
    @beimenjun
    值得注意的是,现在它的这个库也带了 使用 Foundation.Stream 的版本.
    因为使用 纯 Socket 即 最底层的 C 库的话,无法激活手机网络.
    参考 :
    https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/UsingSocketsandSocketStreams.html

    > Note: POSIX networking does not activate the cellular radio on iOS. For this reason, the POSIX networking API is generally discouraged in iOS.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1066 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:06 · PVG 03:06 · LAX 12:06 · JFK 15:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.