Post

Replies

Boosts

Views

Activity

Reply to Problems setting up server using Network.framework
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!
Jul ’20
Reply to Problems setting up server using Network.framework
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?
Jul ’20
Reply to Getting four accepts for a single incoming connection request
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 :-)
Jul ’20