rsms / peertalk

iOS and Mac Cocoa library for communicating over USB
https://rsms.me/peertalk/
MIT License
3.43k stars 502 forks source link

QUE: Example app, why is connecting to LocalIPv4Port #13

Closed peterpaulis closed 9 years ago

peterpaulis commented 9 years ago

Why is the example app trying to enqueueConnectToLocalIPv4Port ?

as everything is working without it

// Start trying to connect to local IPv4 port (defined in PTExampleProtocol.h) [self enqueueConnectToLocalIPv4Port];

and iam also wondering a bit why it works, as the client iOS app listnes on IPV4 port [channel listenOnPort:PTExampleProtocolIPv4PortNumber IPv4Address:INADDR_LOOPBACK callback:^

rsms commented 9 years ago

If you look at the code you'll find that it uses a queue to schedule connects when a device is connected. I.e. the queue is suspended when the device is disconnected and is resumed when the device has been connected.

Also, it's ages ago I wrote this code and I've forgotten everything, so I just found this out myself. Just read the code and you should be able to have your questions answered.