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
GFTP(1) 						      General Commands Manual							   GFTP(1)

NAME
gftp - a graphical ftp client SYNOPSIS
gftp [options] [[proto://][ user : [pass] @] site [: port ][/ directory ]] DESCRIPTION
gFTP is a multiprotocol file transfer program for X Windows and the console. It features support for the FTP, SSH, HTTP, and local file system protocols, simultaneous downloads, resuming of interrupted file transfers, file transfer queues, downloading of entire directores, ftp and http proxy support, remote directory caching, bookmarks menu, stop button and many more features OPTIONS
You may enter a url on the command line that gFTP will automatically connect to when it starts up. --help, -h Display program usage, and quit --version, -v This will display the current version of gFTP, and exit --download, -d This tells gFTP to download the files and directories specified in the url passed on the command line. user This is the username that you will login as to the remote site. If no username is supplied, the default is to login as anonymous. pass This is the password you will use to login to the remotesite. If you do not enter a password, then gFTP will ask you for one when it starts up. I do not recommend entering your password on the command prompt. Anyone that has access to your machine will be able to see your username and password with the ps(1) command. If you are logging in as anonymous, you do not need to pass a password since gFTP will automatically send your email address as your password. site This is the remote site you want to connect to port This is the port that the remote server is listening on. If you do not enter a port, it will default to using the ftp port listed in the services(5) file. If the entry doesn't exist there, it will default to port 21. directory This is the default directory to change to once you are connected to the remote server. FILES
~/.gftp/gftprc Per user configuration file. This file is commented very well, so that is why there isn't a manpage for it. Most of the options in here can be set inside gFTP itself. BUGS
If you find any bugs in gFTP, please report them directly to the author. AUTHOR
Brian Masney <masneyb@gftp.org> - http://www.gftp.org/ FEBURARY 2001 GFTP(1)