How to encapsulate this ?


 
Thread Tools Search this Thread
Top Forums Programming How to encapsulate this ?
# 1  
Old 11-14-2006
How to encapsulate this ?

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 ! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question
JSONBOT(1)							    jsb manual								JSONBOT(1)

NAME
jsb-convore - The JSONBOT convore program SYNOPSIS
jsb-convore is a bot for the convore group chat network built on the JSONBOT framework. DESCRIPTION
jsb-convore connects to a convore group in much the same way as jsb-irc connects to an IRC channel. USAGE
Usage: jsb-convore [options] Options: --version show program's version number and exit -h, --help show this help message and exit -d DATADIR, --datadir=DATADIR datadir of the bot -o OWNER, --owner=OWNER owner of the bot -l LOGLEVEL, --loglevel=LOGLEVEL loglevel of the bot -p PASSWORD, --password=PASSWORD set password used to connect to the server -c CHANNEL, --channel=CHANNEL channel to join --name=NAME bot's name -u USERNAME, --username=USERNAME username of the bot DOCUMENTATION
See http://jsonbot.org for more documentation or see http://jsonbot.googlecode.com SEE ALSO
jsb(1), jsb-backup(1), jsb-init(1), jsb-irc(1), jsb-xmpp(1), jsb-fleet(1), jsb-sed(1), jsb-tornado(1), jsb-stop(1), jsb-udp(1), jsonbot(1) AUTHOR
This manual page was written by Jeremy Malcolm <terminus@debian.org>, for the Debian GNU/Linux system (but may be used by others). Debian GNU/Linux 22 Nov 2011 JSONBOT(1)