问题描述
我想创建一个不使用显式服务器的简单聊天应用程序.主要要求是用户可以同时与许多朋友聊天(就像在Skype上一样).我的意思不是这里的会议聊天,而是多个单独的聊天窗口.
I want to create a simple chat application that doesn't use an explicit server. The main requirement is that the user can simultaneously chat with many friends (just like on Skype etc.). I do not mean a conference chat here, just multiple separate chat-windows.
目前,我只希望使用LAN消息应用程序,但是如果设计易于扩展到Internet连接,我将不胜感激.
Currently, I want only a LAN messaging application but I'd appreciate, if the design was easy to extend to Internet connections.
我想知道什么样的设计适合这样的应用程序.
I wonder what design is appropriate for such an application.
- 您如何看待一个解决方案,其中每个用户应用程序都有一个
TcpListener
(隐式服务器)和多个TcpClient
对象-每个与他/她交谈的朋友一个对象. - 如何验证远程用户?聊天应用程序应该生成证书(X509还是其他),还是只是假设要信任局域网中的用户:)
- What do you think about a solution, where each user app has a
TcpListener
(the implicit server) and multipleTcpClient
objects - one for each friend he/she is talking to. - What about authenticating the remote users? Should the chatting app generate a certificate (X509 or sth) or just assume that the users in a LAN are to be trusted :)
最诚挚的问候
推荐答案
HttpListener
+ WebClient(or HttpWebRequest)
可以为您提供更多用于身份验证/安全性的工具.基本身份验证,Ntlm,集成Windows身份验证,https等,它们对防火墙更友好.
HttpListener
+ WebClient(or HttpWebRequest)
can provide you more tools for authentication/security.Basic Authentication, Ntlm, Integrated Windows Authentication, https etc. and they are more firewall friendly.
这篇关于C#P2P聊天应用程序设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!