Hello !
I'm writing a chat program , and I have a curiozity. I'm curently using
two ports ( sockets ) for client - server interconections.
One socket is used for ordinary (
normal ) data ( Ex : data on main-chat ) , and the another ( two socket ) is used to send
management data : ( Ex : I mean username , password and another management datas. ).
Lets give you an example , to be better understood :
I have one client connected to the server . I send from the client to the server the username and the password. I'm sending those two on the management socket . Why that ?
- client 1 is sending it's username on management port . If I use only one
single port , client username could interfere with same ordinary data , and another client could just type something on main-chat and the server say : " Hey , it's a username ! altough it was just an ordinary data ". Because of that I'm using two sockets : one for management ( usernames , etc ) and one for ordinary data.
But I only want to use one socket ( client - server ). How do I
MARK management data with some flag ( or I don't know ) for the server to differ it from ordinary data. I only want one port for the connection ( one socket with client - server / server - client ).
Practicaly , I want the server , not to listen with select those two socket ( for every client ) , I want it to listen for
marked ( management data ) and
non-marked ordinary data . Is it posible , to mark some data , for the server , to realize , is management data , not ordinary data ? ..
I mean an example could be :
-the server listening 2 priority ( or more type of data ).
-on thread one , I'm listening for priority 1 data ( ordinary ) [ it was send with priority 1 flag ) , and on another thread I listen for priority 10 data [ mangement data ].
Is it posibile , and if is , I want some ideas . Thanks !