- TCPConnection
- TCPServer
##Usage
co {
do {
// create an echo server on localhost:8080
let server = try TCPServer(host: "127.0.0.1", port: 8080)
while true {
// waits for an incoming connection, receives 1024 bytes, sends them back
let connection = try server.accept()
let data = try connection.receive(upTo: 1024)
try connection.send(data)
}
} catch {
print(error)
}
}
nap(for: 100.milliseconds)
// create a connection to server at localhost:8080
let connection = try TCPConnection(host: "0.0.0.0", port: 8080)
// opens the connection, sends "hello"
try connection.open()
try connection.send("hello")
// waits for a message, prints it out
let data = try connection.receive(upTo: 1024)
print(data)
import PackageDescription
let package = Package(
dependencies: [
.Package(url: "https://github.com/VeniceX/Zewo.git", majorVersion: 0, minor: 14)
]
)
If you need any help you can join our Slack and go to the #help channel. Or you can create a Github issue in our main repository. When stating your issue be sure to add enough details, specify what module is causing the problem and reproduction steps.
The entire Zewo code base is licensed under MIT. By contributing to Zewo you are contributing to an open and engaged community of brilliant Swift programmers. Join us on Slack to get to know us!
This project is released under the MIT license. See LICENSE for details.