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://codercto.com/soft/d/233.html

Effective JavaScript

Effective JavaScript

David Herman / Addison-Wesley Professional / 2012-12-6 / USD 39.99

"It's uncommon to have a programming language wonk who can speak in such comfortable and friendly language as David does. His walk through the syntax and semantics of JavaScript is both charming and h......一起来看看 《Effective JavaScript》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

随机密码生成器
随机密码生成器

多种字符组合密码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具