Swift Socket 封装库 SwiftSockets

码农软件 · 软件分类 · 网络工具包 · 2019-02-27 10:14:19

软件介绍

SwiftSockets 是一个简单的 Swift Socket 封装库。

服务器端:

let socket = PassiveSocket(address: sockaddr_in(port: 4242))
socket.listen(dispatch_get_global_queue(0, 0), backlog: 5) {
  println("Wait, someone is attempting to talk to me!")
  $0.close()
  println("All good, go ahead!")
}

客户端:

let socket = ActiveSocket().onRead {
  let (count, block, errno) = $0.read()
  if count < 1 {
    println("EOF, or great error handling \(errno).")
    return
  }
  println("Answer to ring,ring is: \(count) bytes: \(block)")
}
socket.connect("127.0.0.1:80") {
  socket.write("Ring, ring!\r\n")
}

本文地址:https://www.codercto.com/soft/d/233.html

Flow-Based Programming (2nd Edition)

Flow-Based Programming (2nd Edition)

CreateSpace / 2010-5-14 / $69.95

Written by a pioneer in the field, this is a thorough guide to the cost- and time-saving advantages of Flow-Based Programming. It explains the theoretical underpinnings and application of this program......一起来看看 《Flow-Based Programming (2nd Edition)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具