     }
 
     func accept() throws -> (Socket, Address, UInt16) {
+        precondition(type == SOCK_STREAM, "\(__FUNCTION__) should only be used on `SOCK_STREAM` sockets")
+        
         var incoming = sockaddr()
         var incomingSize = socklen_t(sizeof(sockaddr))
         let socket = Darwin.accept(descriptor, &incoming, &incomingSize)
         if socket < 0 {
             throw Errno(rawValue: errno) ?? Error.Unknown
         }
-
+        
         let (address, port) = try Address.fromSockaddr(incoming)
         return (Socket(socket), address, port)
     }

        descriptor = -1
    }


    public var reuse: Bool {
        get {

import SwiftUtilities

public class Socket {
    
    public typealias SocketType = Int32
    
    public private(set) var descriptor: Int32

    public init(_ descriptor: Int32) {
