Setup: A tool with a digital camera, an iPhone.
- A cellphone connects to the machine’s wi-fi community. I determine the gateway (on this case the machine’s IP) through
NWPathMonitor. - I have to ship “begin” command to the machine’s IP and a particular port (say,
192.168.5.1:12345). For that I set upNWConnectionand ship knowledge when prepared throughconnection.ship(content material:completion:). - The machine then begins to constantly write within the connection’s port. However utilizing the Apple’s
Communitylib I can solely get the response as soon as throughconnection.receiveMessage(completion:)and such. I might have listened withNWListener, however on this use case I can not, since I’ve to jot down first after which hear for responses. And even after I create a Listener on the connection’s port (from the cellphone’s facet) (withallowLocalEndpointReuse, if it issues), nothing occurs. - Once I’m completed, I have to ship “cease” on this very socket.
I experimented with some Mac device referred to as “PacketSender” and it receives all of the responses alright, after I ship a “begin” command, till I ship “cease”. Is that this a limitation of the Community lib, ought to I take advantage of another device, or do I miss one thing?
Thanks!
