FastCGIServer
public class FastCGIServer : Server
A server that listens for incoming HTTP requests that are sent using the FastCGI protocol.
-
Declaration
Swift
public typealias ServerType = FastCGIServer -
The
ServerDelegateto handle incoming requests.Declaration
Swift
public var delegate: ServerDelegate? -
Port number for listening for new connections
Declaration
Swift
public private(set) var port: Int? { get } -
The address of a network interface to listen on, for example “localhost”. The default is nil, which listens for connections on all interfaces.
Declaration
Swift
public private(set) var address: String? { get } -
A server state.
Declaration
Swift
public private(set) var state: ServerState { get } -
Whether or not this server allows port reuse (default: disallowed)
Declaration
Swift
public var allowPortReuse: Bool -
Undocumented
Declaration
Swift
public init() -
Listens for connections on a socket
Declaration
Swift
public func listen(on port: Int, address: String? = nil) throwsParameters
onport number for new connections
addressThe address of the network interface to listen on. Defaults to nil, which means this server will listen on all interfaces.
-
Static method to create a new
FastCGIServerand have it listen for conenctionsDeclaration
Swift
public static func listen(on port: Int, address: String? = nil, delegate: ServerDelegate?) throws -> FastCGIServerParameters
onport number for accepting new connections
addressThe address of the network interface to listen on. Defaults to nil, which means this server will listen on all interfaces.
delegatethe delegate handler for FastCGI/HTTP connections
Return Value
a new
FastCGIServerinstance -
Listens for connections on a socket
Declaration
Swift
@available(*, deprecated, message: "use 'listen(on:﹚ throws' with 'server.failed(callback:﹚' instead") public func listen(port: Int, errorHandler: ((Swift.Error) -> Void)? = nil)Parameters
portport number for new connections (ex. 9000)
errorHandleroptional callback for error handling
-
Static method to create a new
FastCGIServerand have it listen for conenctionsDeclaration
Swift
@available(*, deprecated, message: "use 'listen(on:delegate:﹚ throws' with 'server.failed(callback:﹚' instead") public static func listen(port: Int, delegate: ServerDelegate, errorHandler: ((Swift.Error) -> Void)? = nil) -> FastCGIServerParameters
portport number for accepting new connections
delegatethe delegate handler for FastCGI/HTTP connections
errorHandleroptional callback for error handling
Return Value
a new
FastCGIServerinstance -
Stop listening for new connections.
Declaration
Swift
public func stop() -
Add a new listener for server being started
Declaration
Swift
@discardableResult public func started(callback: @escaping () -> Void) -> SelfParameters
callbackThe listener callback that will run on server successfull start-up
Return Value
a
FastCGIServerinstance -
Add a new listener for server being stopped
Declaration
Swift
@discardableResult public func stopped(callback: @escaping () -> Void) -> SelfParameters
callbackThe listener callback that will run when server stops
Return Value
a
FastCGIServerinstance -
Add a new listener for server throwing an error
Declaration
Swift
@discardableResult public func failed(callback: @escaping (Swift.Error) -> Void) -> SelfParameters
callbackThe listener callback that will run when server throws an error
Return Value
a
FastCGIServerinstance -
Add a new listener for when listenSocket.acceptClientConnection throws an error
Declaration
Swift
@discardableResult public func clientConnectionFailed(callback: @escaping (Swift.Error) -> Void) -> SelfParameters
callbackThe listener callback that will run
Return Value
a Server instance
View on GitHub
FastCGIServer Class Reference