PDA

View Full Version : Is there common practice on how to handle Socket data in socket programming?



ayanda83
9th January 2018, 14:10
Hi there guys, I am writing this Client-Server software where the server must authenticate the user. The username and pwd is sent to the server through a QTcpSocket, ofcourse this data is sent in form of a QByteArray. My problem is separating the username and pwd on the server side so that the server can authenticate. I have a bunch of ideas on on how I can do this but I was wondering if there is common practice on how this is done. After authenticating the user there is a lot of back and font communication between the client and the server, is there also common practice on how socket data is handled?

Thanking you in advance.

high_flyer
9th January 2018, 15:31
I have a bunch of ideas on on how I can do this but I was wondering if there is common practice on how this is done.
Usually its done via serialization.

d_stranz
9th January 2018, 23:59
Usually its done via serialization.

For example, by a formal protocol such as SOAP (https://en.wikipedia.org/wiki/SOAP), or by an informal protocol you invent yourself which is understood by both your client and your server.