summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadREST/Transport/Socks5/NWConnection+Extensions.swift
blob: 3a7c7abecd3c372fa5b6883958a30ee96ebcf264 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//
//  NWConnection+Extensions.swift
//  MullvadTransport
//
//  Created by pronebird on 20/10/2023.
//

import Foundation
import Network

extension NWConnection {
    /**
     Read exact number of bytes from connection.
    
     - Parameters:
        - exactLength: exact number of bytes to read.
        - completion:  a completion handler.
     */
    func receive(exactLength: Int, completion: @Sendable @escaping (Data?, ContentContext?, Bool, NWError?) -> Void) {
        receive(minimumIncompleteLength: exactLength, maximumLength: exactLength, completion: completion)
    }
}