BlueSocketSimpleServer
public class BlueSocketSimpleServer : CurrentConnectionCounting
An HTTP server that listens for connections on a TCP socket and spawns Listeners to handle them.
-
The port we’re listening on. Used primarily to query a randomly assigned port during XCTests
Declaration
Swift
public var port: Int -
Undocumented
Declaration
Swift
public class BlueSocketSimpleServer : CurrentConnectionCounting -
Starts the server listening on a given port
- Parameters:
- port: TCP port. See listen(2)
- handler: Function that creates the HTTP Response from the HTTP Request
Throws
Error (usually a socket error) generatedDeclaration
Swift
public func start(port: Int = 0, queueCount: Int = 0, acceptCount: Int = 0, handler: @escaping HTTPRequestHandler) throws - Parameters:
-
Stop the server and close the sockets
Declaration
Swift
public func stop() -
Count the connections - can be used in XCTests
Declaration
Swift
public var connectionCount: Int
View on GitHub
BlueSocketSimpleServer Class Reference