/*
Copyright (c) [2023] [squallzhao]
fountain is licensed under APACHE LICENSE, VERSION 2.0.
You can use this software according to the terms and conditions of the APACHE LICENSE, VERSION 2.0.
You may obtain a copy of APACHE LICENSE, VERSION 2.0 at: https://www.apache.org/licenses/LICENSE-2.0
*/
package microservice.web.server
import microservice.web.socket.*
import microservice.web.http11.*
public class CannonServer{
var port: UInt16 = 8080
var router: IRouter
public init(router:IRouter){
this.router = router
}
public func setPort(port: UInt16): CannonServer{
this.port = port
return this;
}
public func getPort():UInt16{
return port;
}
public func start(maxConnections: Int32){
var endpoint = EndPoint(port,Http11DataProcessor(AdapterDispatcher(router)))
endpoint.setMaxConnections(maxConnections)
endpoint.start()
}
public func stop(){
}
}