diff --git a/Sources/TCPSocket.swift b/Sources/TCPSocket.swift index 518d900..c7f4859 100644 --- a/Sources/TCPSocket.swift +++ b/Sources/TCPSocket.swift @@ -114,7 +114,7 @@ public final class TCPSocket { let size = socklen_t(MemoryLayout.size) // bind the address and port on socket guard withUnsafePointer(to: &address, { pointer in - return pointer.withMemoryRebound(to: sockaddr.self, capacity: Int(size)) { pointer in + return pointer.withMemoryRebound(to: sockaddr.self, capacity: Int32(size)) { pointer in return SystemLibrary.bind(fileDescriptor, pointer, size) >= 0 } }) else { @@ -162,7 +162,7 @@ public final class TCPSocket { let size = socklen_t(MemoryLayout.size) // connect to the host and port let connectResult = withUnsafePointer(to: &address) { pointer in - return pointer.withMemoryRebound(to: sockaddr.self, capacity: Int32(size)) { pointer in + return pointer.withMemoryRebound(to: sockaddr.self, capacity: Int(size)) { pointer in return SystemLibrary.connect(fileDescriptor, pointer, size) } }