فهرست منبع

in_port_t is cross-platform

Julien Chaumond 10 سال پیش
والد
کامیت
55564a4d16
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      Sources/Swifter/HttpServer.swift
  2. 1 1
      Sources/Swifter/Socket.swift

+ 1 - 1
Sources/Swifter/HttpServer.swift

@@ -43,7 +43,7 @@ public class HttpServer {
         return router.routes()
     }
     
-    public func start(listenPort: UInt16 = 8080) throws {
+    public func start(listenPort: in_port_t = 8080) throws {
         stop()
         listenSocket = try Socket.tcpSocketForListen(listenPort)
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) {

+ 1 - 1
Sources/Swifter/Socket.swift

@@ -27,7 +27,7 @@ enum SocketError: ErrorType {
 
 public class Socket: Hashable, Equatable {
     
-    public class func tcpSocketForListen(port: UInt16 = 8080, maxPendingConnection: Int32 = SOMAXCONN) throws -> Socket {
+    public class func tcpSocketForListen(port: in_port_t = 8080, maxPendingConnection: Int32 = SOMAXCONN) throws -> Socket {
         
         #if os(Linux)
             let socketFileDescriptor = socket(AF_INET, Int32(SOCK_STREAM.rawValue), 0)