Feedback NetworkListener: Endpoint, QUIC

Good morning,

I have been playing with he new Networking framework released in beta, and i think its amazing how powerful and simple it is.

However i have been tackling some issues with it, it seems that the NetworkListener does not allow us to configure a specific endpoint for any of the protocols, UDP, TCP (QUIC, TLS)

Is this intended or just not missing features as of the Beta ?

I figured out how to use bonjour to get a port (as i am brand new to using Networking on macOS and Swift)

I get that the use of this is mainly as a client to connect to servers, but it would make more sense to have a high level abstraction of what already exist, wouldn't it be more intuitive to configure a NetworkEndpoint that contains either a Bonjour Service or an endpoint with configured port that we can then configure on the Listener, instead of doing .service(...) ?

Answered by DTS Engineer in 856346022
NetworkListener does not allow us to configure a specific endpoint for any of the protocols

Because, for example, you want to listen on a specific port?

If so, there is a way to do that:

let listener = try NetworkListener(using: .parameters {
    TCP()
}.localPort(12345))

Share and Enjoy

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

Accepted Answer
NetworkListener does not allow us to configure a specific endpoint for any of the protocols

Because, for example, you want to listen on a specific port?

If so, there is a way to do that:

let listener = try NetworkListener(using: .parameters {
    TCP()
}.localPort(12345))

Share and Enjoy

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

Feedback NetworkListener: Endpoint, QUIC
 
 
Q