使用C#的简单聊天程序 [英] Simple chat program using C#

查看:107
本文介绍了使用C#的简单聊天程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说我在连接到路由器的2台计算机上有一个小型的c#Windows窗体应用程序.在一台计算机上,我想键入一条消息,然后按Enter键,我想在另一台计算机上显示.

Lets say I have a small c# windows form application in 2 computers connected to a router. In one computer i want to type a message and when i press enter i want to show up in the other computer. How can i do that?

推荐答案

这里是一个开始的地方.
简单Messenger-类似于AC#MSN Messenger的聊天应用程序 [ ^ ]
Here is a place to start.
Simple Messenger - A C# MSN Messenger-like Chat Application[^]


执行此操作的方法过多.此外,很明显,您所描述的可能不是最终功能,因此,您的设计将取决于您更高级的计划.您可以选择从原始套接字到TpcListener/TcpClient到经典远程处理或WCF(尤其是自托管).

我在过去的回答中提供了有关.NET网络某些主要级别的简短(但不完整)概述:
我如何将byte []发送到另一台PC [ ^ ],
在局域网上与两个Windows应用程序进行通信. [^ ].

—SA
There are too many ways of doing this. Besides, it''s pretty much apparent that what you describe could not be the final functionality, so, your design will depend on your more advanced plans. You can choose from raw sockets to TpcListener/TcpClient to classical remoting or WCF (especially self-hosted).

I provided my short (and incomplete) overview of some major levels of .NET networking in my past answers:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

—SA


这篇关于使用C#的简单聊天程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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