Want to share several notes that I did during development of communication protocol for my robot using Skype App2App.
Lets assume we have 3 skypes running (or skypekits):
- UserA logged on PC1
- UserA logged on PC2 (yes, same user, but on different machine)
- UserB logged on PC3
All accounts create application TestApp1. And now when:
Action | Streams | Datagrams | Comments | ||||
---|---|---|---|---|---|---|---|
UserA - PC1 | UserA - PC2 | UserB | UserA - PC1 | UserA - PC2 | UserB | ||
UserA-PC1 connects to UserB | UserB:1 | - | UserA:1 | - | - | - | - |
UserA-PC1 disconnects UserB | - | - | - | - | - | - | The same result will be in opposite case, when UserB disconnects UserA-PC1. |
UserA-PC1 connects to UserB again | UserB:2 | - | UserA:2 | - | - | - | Numeration of streams increasing. |
Restart skype on UserA-PC1 and connect to UserB again | UserB:1 | - | UserA:3 | - | - | - | Numeration of streams done on each client app independently. |
UserA-PC2 connects to UserB | UserB:1 | UserB:1 | UserA:2 UserA:3 | - | - | - | - |
UserB sends datagram to UserA-PC1 | UserB:1 | UserB:1 | UserA:2 UserA:3 | data | - | - | Datagram sent per stream. |
UserB sends datagram to UserA-PC2 | UserB:1 | UserB:1 | UserA:2 UserA:3 | - | data | - | - |
UserB goes offline (by user action) | UserB:1 | UserB:1 | - | - | - | - | Need to clear streams on UserA sides. |
UserB goes online and reconnects to UserA | UserB:1 UserB:2 | UserB:1 UserB:2 | UserA:4 UserA:5 | - | - | - | Application and numerations preserved. UserB:1 streams exists but not functioning. |
UserB deletes application without disconnecting | UserB:1 UserB:2 | UserB:1 UserB:2 | - | - | - | - | Now we have 2x2 orphane streams. |
That's it, now it is straightforward that when skype gives you array of streams you should use all of them for communication and send messages in cycle to each stream. There can be mix of orphane and live streams, and if you take from array only first it could be not functioning in multiple reconnection scenarios.