在没有客户端请求的情况下在客户端套接字上发送数据C# [英] Send Data on Client Socket without Client Requesting for it C#

查看:122
本文介绍了在没有客户端请求的情况下在客户端套接字上发送数据C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计带有多个套接字客户端的套接字服务器,其中一旦客户端连接到服务器,服务器应该开始向客户端发送数据,客户端必须接收数据,当客户端断开连接时,服务器应停止向该服务器发送数据客户。任何人都可以建议在C#中实现上述任务的方法。

I want to Design Socket Server with Multiple Socket Client, in which once the Client gets connected to Server, server should start sending data to client and client must receive the data, and when Client gets disconnected server should stop sending data to that client. Can anyone suggest the method to achieve the above task in C#.

推荐答案

那么你的实现非常简单。可能不明显的一点是服务器如何检测客户端已断开连接。但是,您可能会发现这是一个常见问题网络 [ ^ ]。
Well your implementation is pretty straightforward. The possibly not-obvious point is how can the server detect that client has disconnected. However, you may find this is a frequent question on the web[^].


这篇关于在没有客户端请求的情况下在客户端套接字上发送数据C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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