I'll take a look at your code. I was definitely receiving and accepting more than one connection, I just wasn't clear on why until I fired up Wireshark. In my case both instances (sender and receiver) were running on the same node in two different simulators so I assumed that everything would be flowing through lo0. Although my example just handles a single connection I would need to generalize this and therefore was thinking that the listen would stay active in case the client (there is only one) restarted. I'll check out your code, thanks again!
Post
Replies
Boosts
Views
Activity
Hi Matt, this is working for me, thank you. I have a follow-up question. I'm sending large messages which can't be sent in one chunk (large images encoded as Data). The receive loop from your example picks up all the fragments according to content.count but it isn't clear when the message is complete to assemble and decode. The doc says that isComplete marks the end of a logical message, but possibly not for plain data. How do I know when I've gotten all the pieces?
Alternatively, is there an interface which does the work for me and returns the entire chunk of data?
I'll ask another way, is there some other API I should be using to pass images peer-to-peer in the LAN?
Hi Quinn, thanks for your quick reply. I realize that I have not mentioned that I'm running xCode 12 and iOS/tvOS 14.
Where are you running the server?
Where are you running the client?
Both are simulators running on my Mac, server is an iOS app and client is tvOS
How are these devices connected?
They are both running in simulators, the server console is visibile in xCode. The client is started by hand in the tvOS simulator.
* What API are you using for the client
Given these constants:
enum NetworkConstants {
		static let serviceDomain = "local."
		static let serviceType =	"_screenshotCliff._tcp"
		static let serviceName = "bongo"
}
The client connects like this (simplified):
let connection = NWConnection(to: .service(name: NetworkConstants.serviceName, type: NetworkConstants.serviceType, domain: NetworkConstants.serviceDomain, interface: nil), using: .tcp)
let client = NetworkConnection(newConnection: connection)
connection?.start(queue: .main)
What IP addresses are assigned to each?
The machine has wireless and ethernet, with the ether on en1
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNELIO>
ether b8:09:8a:cf:fe:3d
inet6 fe80::18c2:7210:652d:f98a%en1 prefixlen 64 secured scopeid 0x5
inet 192.168.0.5 netmask 0xffffff00 broadcast 192.168.0.255
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=50b<RXCSUM,TXCSUM,VLANHWTAGGING,AV,CHANNEL_IO>
ether ac:87:a3:1e:9c:22
inet6 fe80::1c86:f135:6ec:1763%en0 prefixlen 64 secured scopeid 0x4
inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (1000baseT <full-duplex,flow-control,energy-efficient-ethernet>)
status: active
Networksetup sez:
Hardware Port: Ethernet
Device: en0
Ethernet Address: ac:87:a3:1e:9c:22
Hardware Port: Wi-Fi
Device: en1
Ethernet Address: b8:09:8a:cf:fe:3d
So it looks like the client is trying to connect on all four possible paths. Sorry for not mentioning the ethernet, I forgot that it is attached :-)
Thank you, the other three connections do indeed drop immediately. Now that I know this is normal I can move on :-)
Thanks again
I have opened a feedback report: FB8750417
I wish Apple would at least say whether they intend to fully support MapKit on tvOS. I filed feedback as suggested at the end of September and have not heard anything. Does it ever go differently from this? Not in my experience.
Sorry, I neglected to mention that this is on tvOS though the focusable() calls indicate so.
Still nothing.
This has been addressed in a recent update and works correctly now.
I'm seeing the same error, though I'm not using a template for my RealityKit app.
Thank you.
It's January 2, 2022 and this still occurs.
Hi,
I can't reproduce it myself, I'm just seeing the crashes in Firebase. Is there a workaround that I might employ? This will cause me to pull back a feature from production. Is there any documentation of the bug? Thanks!
This can be achieved by setting the background in the environment:
// disable camera
arView.environment.background = .color(.white)
// enable camera
arView.environment.background = .cameraFeed()
Although I marked this as the correct answer it is in fact incomplete. This changes the background but the camera is in fact still active, while you move the camera, the relative orientation of the device changes.