Click here to Skip to main content
15,906,081 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello again,

Ok so im working on a chat server and i just need to ask a few things about server architecture and by that i mean what is the best way to get things done?

So if theres anyone out there that knows servers then please post.... realy anyone that can help me pleas post.

I have got most of my info from C# code so if C# ppl know any more please feel free to post coz i can work with the code..... mostly.

If any of my code is needed the ill post it just let me know what you need!

1) When a msg is sent to global(main room) should the MSG be sent back to the sender to be displayed or just shown local(not sent back to the sender but update the UI with the msg to save network traffic)

2) Should i use events eg: client gets a msg and raisevent haveMSG(xx xxxx)
that just passes the msg off to the update UI method or have the client just go strait to the updateUI method and bypass the need for events or is there a need for events?

3) Right now i have the server\client broken down into parts is this how i should do things

eg: SocketObject(server\client object)
ServerCls\ClientCls(Server\Client Frontend)
LogicUnits(all work on msg's is done here)
Object Pools(Msg objects, SAEA objects, Buffer objects and logic units\workers)

Server\Client UI

4) Is SocketAsyncEventArgs the best way to go for a chat server or should i be useing the older beginXXX async methods, i have been playing with the async CTP so could i go down that path? Right now the server has 2 modes SAEA or my Async CTP way of reading\writing

5) I do alot of boject pooling..... in my mind having the server start with 90% of the memory it will need sounds good but is this a but thing?

6) I have done much reading but there isnt much out there other than the few tuts that i have done and the helped..... i think i have tryed most of the server\client code out there for VB and C# so if anyone has any books or post i should read then pleas let me know.

7) What would the best way to do encryiption be?

most of my info came from :[^]

C# SocketAsyncEventArgs High Performance Socket Code[^]

A Chat Application Using Asynchronous TCP Sockets[^]
Updated 20-Jun-11 1:50am

Hello beauty
I did a chat application two years a go , because of that a have a little expert in network programing , I suggest you use TcpListener and TcpClient to connect two program over a network or internet
if you use BinaryFormatter with these two class you can transmitt each kind of data over network

use these classes , and if you have some problems i can send you some useful code
Share this answer
Hey mate ty for your time,

I was useing the TCP wrapper classs but a friend said i should move over to sockets and i did.

I have been working on this for over 1 year now i have the server and client working 100%, i was useing the beginXXX in the TCPClient\Listener..... but i then found out about SocketAsyncEventArgs and rebuild the network core of my server\client.

Im now looking at ways to optimise my code by doing things a better\right way so thats what this post is about.

@Reza ty for your time got any thing else to add? all input will help.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900