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

NAME
rxterm -- start a secure remote xterm SYNOPSIS
rxterm [-l username] [-k] [-r rsh_args] [-x xterm_args] [-K kx_args] [-w term_emulator] [-b rsh_program] host [port] DESCRIPTION
The rxterm program starts an xterm window on host host. From this window you will also be able to run X clients that will be able to connect securely to your X server. If port is given, that port will be used instead of the default. The supported options are: -l Log in on the remote host as user username. -k Disable keep-alives. -r Send rsh_args as arguments to rsh. -x Send xterm_args as arguments to xterm. -X Send kx_args as arguments to kx. -w Use term_emulator instead of xterm. -b Use rsh_program instead of rsh. -v Be verbose. EXAMPLE
To login from host foo (where your display is) to host bar, you might do the following. 1. On foo: rxterm bar 2. You will get a new window running an xterm on host bar. In this window you will be able to start X clients. SEE ALSO
kx(1), rsh(1), rxtelnet(1), tenletxr(1), kxd(8) KTH_KRB April 11, 2003 KTH_KRB