如何使用C#创建自己的IM服务器和客户端. [英] How to create your own IM server and client..using c#?

查看:129
本文介绍了如何使用C#创建自己的IM服务器和客户端.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是C#通信平台的新手.我有兴趣创建一个IM网络,以便我的朋友可以连接到它.我不知道创建IM网络的机制.当我通过google搜索时,我什么都没得到,这加剧了我对此主题的困惑.

我想知道的是如何创建IM网络...?我可以开发基于IP的客户端软件,但考虑到msn它不是基于ip的聊天..所以我想开发仅适用于我的IM网络的Im客户端.

Hi
I am new to the c# communication platforms. I am interested in creating a IM network so that my friends can be connected to it. I dont know mechanism of creating IM network. When I searched through google, I didnt got anything and it increases my confusion on this subject.

What I want to know is how to create an IM network ... ? I can develop IP based client software but consider msn it is not ip based chatting .. so I want to develop Im client that only works with my IM network

推荐答案

,使用.NET可以比以往更轻松地获得良好的结果.尚不清楚您是否需要基于Web的或自定义的(这更容易).您仍然可以使用HTTP协议来穿越防火墙.

好吧,最重要的常见错误应该避免:不要为每个客户端创建线程;不要为每个客户端创建线程.它们只能由两个线程提供服务:一个监听新的连接,另一个忙于与可用的用户列表(连接的远程套接字)进行交换.

如果您查看我在过去的解决方案中描述的框架设计,您可能会有一个大概的想法: ^ ].

在这里,您可以找到我对可以选择的联网级别的概述:
如何将byte []发送到另一台PC [ ^ ],
在局域网上与两个Windows应用程序进行通信. [ ^ ].

但是,我认为TcpClient/TcpListener的水平对于您的应用程序是最合适的.我还是建议您做一些自己的研究.

与您要执行的操作相比,它得到了极大的简化,因此您的项目将花费大量的精力.不过,我相信对于经验丰富的开发人员而言,首次解决此类问题是完全可行的.

祝你好运,
—SA
Surprisingly, with .NET this is easier to achieve good results then ever before. It''s not clear if you need it Web-based or custom (which is way easier). You can still use HTTP protocol in order to go through firewalls.

Well, most important common mistake to avoid: don''t create a thread per the client; they all can be served by just two threads: one listening to new connection, another busy with exchange with the available list of users (connected remote sockets).

You can have a rough idea if you look at the skeleton design I described in my past solution: Multple clients from same port Number[^].

Here you can find my overview of the levels of networking you can choose from:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

However, I think for your application the level of TcpClient/TcpListener would be the most suitable. I recommend you do some of your own research though.

It is highly simplified compared to what you want to do, so your project will take considerable effort. Still, I''m sure it is quite feasible for an experience developer solving such problem for the first time.

Good luck,
—SA


这篇关于如何使用C#创建自己的IM服务器和客户端.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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