Best Answer roaminggamer , 13 November 2018 - 09:55 AM
I dug up an old product of mine and stripped out the Client-Server Code.
It is not perfect, but it still seems to work.
This example uses the client/server modules to:
1. Create an app w/ two choices.
- A. Be the server
- B. Be the Client.
2. After you select server (can only be one) or client (1+ is OK), the app allows you to send and receive messages.
- The code in main.lua uses SSK for the buttons and to set up the message event listeners.
- The two modules each have a tiny summary of functions at the top.
- From any client, you can send messages to the server, a specific client, or all clients.
- From the server you can send messages to a single client or all of them.
- While this code seems to be functional, you need to verify it on all targets and between them.
- You need to set up ATS in build.settings if you want to test on iOS. I forgot to add this in the example.
- If you find this fails in some cases, please post back with specific details about the failure and test device(s) so I know it failed.
- I may add this directly to SSK later, but right now you get an early sneakpeek.
- I used 'localhost', but you may need to use the machine IP instead. The code to set that is already in the example, just commented out.
PS - I have only tested this on Window 10 running three instances of the simulator (2018.3363).
PPS - The name of the example 'peer2Peer' is a misnomer. Originally I tried to provide a pure Peer-to-Peer (serverless) example, but I could not. So, I just used the same base for a client-server solution instead.