Where are the source codes of Network.framework?

Hello,

I found the source code for an older version of Network.framework here: https://github.com/xamarin/binding-tools-for-swift-reflector/tree/master/stdlib/public/Darwin/Network

But when I check the latest repository of swift from https://github.com/apple/swift. I can't find the path to stdlib/public/Darwin/Network.

Does anyone know where these source codes are now?

Thanks

Network framework is not open source.

The source code you referenced [1] but it doesn’t buy you much. It’s the source code for the Swift overlay and all the interesting stuff is in the underlying C implementation.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] FYI, I suspect that this source dates from a time when Swift overlays were part of the compiler. Nowadays they’re part of the framework, and hence this is no longer in the Swift repo.

Thanks for reply. I actually wanted to find some documentation about NWConnection at first. Because there are so few documents now. By coincidence, I found the code about NWConnection through google. And through the comments on the send method in the code, one of my questions was solved, that is, what will happen if send is called before NWConnection enters the ready state? So I want to see if there is any updated information in the latest code. In fact, I don't want to delve into the underlying implementation of Network.framework. Just want to see some more documentation on how to use it.

Code from https://github.com/xamarin/binding-tools-for-swift-reflector/blob/master/stdlib/public/Darwin/Network/NWConnection.swift#L538

/// Send data on a connection. This may be called before the connection is ready,
/// in which case the send will be enqueued until the connection is ready to send.
/// This is an asynchronous send and the completion block can be used to
/// determine when the send is complete. There is nothing preventing a client
/// from issuing an excessive number of outstanding sends. To minimize memory
/// footprint and excessive latency as a consequence of buffer bloat, it is
/// advisable to keep a low number of outstanding sends. The completion block
/// can be used to pace subsequent sends.
/// - Parameter content: The data to send on the connection. May be nil if this send marks its context as complete, such
///   as by sending .finalMessage as the context and marking isComplete to send a write-close.
/// - Parameter contentContext: The context associated with the content, which represents a logical message
///   to be sent on the connection. All content sent within a single context will
///   be sent as an in-order unit, up until the point that the context is marked
///   complete (see isComplete). Once a context is marked complete, it may be re-used
///   as a new logical message. Protocols like TCP that cannot send multiple
///   independent messages at once (serial streams) will only start processing a new
///   context once the prior context has been marked complete. Defaults to .defaultMessage.
/// - Parameter isComplete: A flag indicating if the caller's sending context (logical message) is now complete.
///   Until a context is marked complete, content sent for other contexts may not
///   be sent immediately (if the protocol requires sending bytes serially, like TCP).
///   For datagram protocols, like UDP, isComplete indicates that the content represents
///   a complete datagram.
///   When sending using streaming protocols like TCP, isComplete can be used to mark the end
///   of a single message on the stream, of which there may be many. However, it can also
///   indicate that the connection should send a "write close" (a TCP FIN) if the sending
///   context is the final context on the connection. Specifically, to send a "write close",
///   pass .finalMessage or .defaultStream for the context (or create a custom context and
///   set .isFinal), and pass true for isComplete.
/// - Parameter completion: A completion handler (.contentProcessed) to notify the caller when content has been processed by
///   the connection, or a marker that this data is idempotent (.idempotent) and may be sent multiple times as fast open data.
public func send(content: Data?, contentContext: NWConnection.ContentContext = .defaultMessage, isComplete: Bool = true, completion: SendCompletion) {
	switch completion {
	case .idempotent:
		_swift_nw_connection_send_idempotent(self.nw, NWCreateDispatchDataFromNSData(content), contentContext.nw, isComplete)
	case .contentProcessed(let handler):
		_swift_nw_connection_send(self.nw, NWCreateDispatchDataFromNSData(content), contentContext.nw, isComplete) { (error) in
			handler(NWError(error))
		}
	}
}

In fact, most of the information in the send method comments also appears in the send method's documentation. But the first paragraph is missing, why?

/// Send data on a connection. This may be called before the connection is ready,
/// in which case the send will be enqueued until the connection is ready to send.
/// This is an asynchronous send and the completion block can be used to
/// determine when the send is complete. There is nothing preventing a client
/// from issuing an excessive number of outstanding sends. To minimize memory
/// footprint and excessive latency as a consequence of buffer bloat, it is
/// advisable to keep a low number of outstanding sends. The completion block
/// can be used to pace subsequent sends.
Where are the source codes of Network.framework?
 
 
Q