Sponsored Content
Full Discussion: How to encapsulate this ?
Top Forums Programming How to encapsulate this ? Post 302096142 by !_30 on Tuesday 14th of November 2006 06:44:36 AM
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
 
EKG(1)							      General Commands Manual							    EKG(1)

NAME
ekg - A Gadu-Gadu compatible client. SYNOPSIS
ekg [ options ] [ commands ] DESCRIPTION
ekg is an experimental Gadu-Gadu client. OPTIONS
-h [--help] Shows command line options. -u username [--user username] Starts ekg with other By default config files are stored in ~/.gg/ (if there is a non-empty $CONFIG_DIR environment variable, ~/$CONFIG_DIR/gg/ is used instead); this option gives ability to create subdirectories structure with other setups. -t theme [--theme theme] Loads theme from the specified file. -c file [--control-pipe file] Creates a named pipe that can be used to control the client. -o [--no-pipe] Disables named pipe creation. -n [--no-auto] Don't connect automagically. After starting program won't automatically connect to the gg servers. -N [--no-global-config] Don't load global configuration file (i.e. /etc/ekg.conf) after user's one. -a [--away[=description]] After connecting sets the status to "away". -b [--back[=description]] After connecting sets the status to "back". -F [--ffc[=description]] After connecting sets the status to "free for chat". -d [--dnd[=description]] After connecting sets the status to "do not disturb". -i [--invisible[=description]] After connecting sets the status to "invisible". -p [--private] After connecting change to "private mode". -v [--version] Prints the client and libgadu library version. -f name [--frontend name] Selects given user interface. 11 November 2002 EKG(1)
All times are GMT -4. The time now is 10:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy