[SOLVED][Socket] manage of two different socket
I have a server program developed in Qt
A computer can connect to the server with a Qt Application
A mobile phone (android programmed in Java) that can also connect to the server Qt
The management of data reception and transmission differs.
I want to know how to recognize the socket of the computer and the phone.
Well, you can add some "identifier" in your exchange protocol.
How can do in Qt and Java
-Each socket whether it is of mobile or Computer is same .
-Each socket has an unique address / socket id through which you can communicate between any devices mobile to mobile ,mobile to computer.
To manage/recognize 2 different sockets use socket id/descriptor to read or write the data from client to server or vice -versa.
What type can be identifier?
Can you give me an example of the structure of the protocol?
you must have developed some protocol for the required
just add new identifier to the request codes
so that after connection establishment
you can first synchronize the connection
then do all your stuff
This is the structure of my package for now
quint16 represent size of message
QString represent message
you can exchange some standard strings in the first couple of packets
so that you can differentiate between the device nodes
You can make identifier in the following ways :
2)Using XML //Recommend
3)Using QRegExp (Regular Expression)
// Any message that starts with "/Anroid:"
Thank you to help me.
I'll try to do with XML Recommend