Skip to content

Commit 6512d13

Browse files
committed
Update CInterop.SocketDescriptor for Windows
1 parent 6c4b231 commit 6512d13

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

Sources/Socket/System/CInterop.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public extension CInterop {
3333
typealias FileEvent = Int16
3434

3535
#if os(Windows)
36-
/// The platform socket descriptor.
36+
/// Native Windows Socket handle
37+
///
38+
/// https://docs.microsoft.com/en-us/windows/win32/api/winsock2/
3739
typealias SocketDescriptor = SOCKET
3840
#else
3941
/// The platform socket descriptor, which is the same as a file desciptor on Unix systems.

Sources/Socket/System/SocketDescriptor.swift

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,11 @@ import SystemPackage
1212
/// Same as ``FileDescriptor`` on POSIX and opaque type on Windows.
1313
public struct SocketDescriptor: RawRepresentable, Equatable, Hashable, Sendable {
1414

15-
#if os(Windows)
16-
#error("Implement Windows support")
17-
/// Native Windows Socket handle
18-
///
19-
/// https://docs.microsoft.com/en-us/windows/win32/api/winsock2/
20-
public typealias RawValue = CInterop.WinSock
21-
#else
22-
/// Native POSIX Socket handle
23-
public typealias RawValue = FileDescriptor.RawValue
24-
#endif
15+
public typealias RawValue = CInterop.SocketDescriptor
16+
17+
public let rawValue: RawValue
2518

2619
public init(rawValue: RawValue) {
2720
self.rawValue = rawValue
2821
}
29-
30-
public let rawValue: RawValue
3122
}

0 commit comments

Comments
 (0)