SocketAsyncEventArgs聊天服务器\客户端(需要体系结构帮助) [英] SocketAsyncEventArgs Chat Server\Client(architecture help needed)

查看:89
本文介绍了SocketAsyncEventArgs聊天服务器\客户端(需要体系结构帮助)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再次问好,

好的,我正在聊天服务器上工作,我只需要问一些有关服务器体系结构的事情,那意味着完成工作的最佳方法是什么?

因此,如果有任何知道服务器的人,那么请发布....真的可以帮助我的人请发布.

我已经从C#代码中获取了大部分信息,因此,如果C#ppl知道更多,请随时发布内容,因为我可以使用该代码.....大多数..

如果需要我的任何代码,请告诉我您需要什么!

1)将味精发送到全局(主房间)时,应将味精发送回发件人以进行显示还是仅显示为本地(不发回发件人,而是使用味精更新UI以节省网络流量)

2)我是否应该使用事件,例如:客户端得到一个味精并引发ventMSG(xx xxxx)
只是将味精传递给更新UI方法,还是让客户端进入更新UI方法并绕过对事件的需要,或者是否需要事件?

3)现在我已将服务器\客户端分解为几个部分,这就是我应该如何做的事情

例如:SocketObject(服务器\客户端对象)
ServerCls \ ClientCls(服务器\客户端前端)
LogicUnits(有关味精的所有工作均在这里完成)
对象池(消息对象,SAEA对象,缓冲区对象和逻辑单元\工作者)

服务器\客户端UI


4)SocketAsyncEventArgs是前往聊天服务器的最佳方法,还是我应该使用较早的beginXXX异步方法,我一直在使用异步CTP,所以我可以沿着那条路走吗?现在,服务器具有2种模式SAEA或我的Async CTP读取\写入方式


5)我进行了大量的池化操作.....在我看来,服务器必须以90%的内存启动,这听起来似乎不错,但这是一个问题吗?


6)我已经做了很多阅读,但是除了我已经做过的一些tut和帮助过的事情之外没有太多其他了.....我想我已经尝试了大部分针对VB和C#的服务器\客户端代码,所以如果任何人都有任何书籍或帖子,我都应该阅读然后请让我知道.

7)进行加密的最佳方法是什么?


我的大部分信息来自: http://www.dreamincode.net/forums/topic/150960 -advanced-p2p-networking-chatrooms-part-1/ [ C#SocketAsyncEventArgs高性能套接字代码 [使用异步TCP套接字的聊天应用程序 [

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 :
http://www.dreamincode.net/forums/topic/150960-advanced-p2p-networking-chatrooms-part-1/[^]

C# SocketAsyncEventArgs High Performance Socket Code[^]

A Chat Application Using Asynchronous TCP Sockets[^]

推荐答案

你好,美女
我做了两年的聊天应用程序,因为这在网络编程方面有一点点专家,我建议您使用TcpListener和TcpClient通过网络或互联网连接两个程序
如果您将BinaryFormatter与这两个类一起使用,则可以通过网络传输各种数据

使用这些类,如果您有任何问题,我可以向您发送一些有用的代码
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


在您的时间里,

我当时使用的是TCP包装器类,但是一个朋友说我应该移到套接字上,然后我做了.

我已经为此工作了1年以上,现在服务器和客户端都可以100%工作,我在TCPClient \ Listener中使用beginXXX ...但是后来我发现了有关SocketAsyncEventArgs的信息,并重建了我的网络核心服务器\客户端.

我现在正在寻找一种通过做一个更好的\正确的方式来优化我的代码的方法,这就是本文的主题.

@Reza ty您还可以添加其他内容吗?所有输入都会有帮助.
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.


这篇关于SocketAsyncEventArgs聊天服务器\客户端(需要体系结构帮助)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆