Hello !
I have a pretty question.I am working on a client-server chat aplication for Linux shell's.
When a user connect , is receives a window for the username . It has to enter the username, which will be used for future chat and private message ( + other option's ). I'm using socket's for network connection.
The point is , after a user is connect to server socket , the user has to enter a username . The problem here comes like that. Where does the chat server knew , if the username string is an ordinary string , used for chat , or the username string itself ?
I figure to do , some easy encaspulation.When the client connect , and receive username window , the username string is encapsulated with , let's say "***" at the end .
Let's say user !_30 is connected . First the client sends "!_30***" to server , the server dencapsulate those 3 '***' , and knows client username.
The problem here is that , when a user accidentaly send's "***" in main chat , whole sistem is doomed . The server sees "***" at the end .. of ( nothing ) and think's a new user is connected to the server.
How can I make this encapsulation/dencapsulation , transparent to send proces , not altering the string , and be doomed like up ..?
Any idea's , raw socket's ? Because the idea I mention is the only one that came , in that moment in my head .
Any ideas , is apreciate ! Cheer's !