I ve created mainly two functions, one to connect, one other to read socket
I think it is quite easy to understand, and easy to modify to what you need, because apart port and ip, you don't have to modify lot of thing :D.
this->connected, is a variable to store connection status, you can use in a function like isConnected :D
This function will read the socket, retrieve the data in receivedData.
In my case, I will deserialize data from string to json, and I will store the message into a customize class, which will store all message.
This function is called each tick, because I have not lot of information send into these socket.
If you prefer to thread it, you can
Aucun commentaire:
Enregistrer un commentaire