使用CAsyncSocket进行UDP广播 [英] UDP Broadcasting using CAsyncSocket

查看:245
本文介绍了使用CAsyncSocket进行UDP广播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我在整个互联网上搜索过。我无法使用CAsyncSocket在UDP广播上找到样本。我不希望客户提供请求和服务器接受它,然后发送和接收开始。我希望像
服务器应用程序启动它时应该广播一个端口并使用相同的端口监听所有客户端。当客户端应用程序启动它不应该向服务器发出请求时,它应该将其IP地址发送到服务器。有人可以给我一些样品
或链接,我可以找到一些样品?我通过创建套接字使用c编程完成了这个。但是我想用CAsyncSocket做到这一点。请帮忙。

解决方案

2015年6月8日凌晨3:05,Mencis写道:


嗨。我在整个互联网上搜索过。我无法使用CAsyncSocket在UDP广播上找到样本。


很奇怪。我在互联网上搜索,并在两分钟内找到了这样的样本。我们使用不同的互联网吗?


http://www.codeproject.com/Articles/16581/Sending-Receiving-UDPpartmentsgrams-with-MFC-s-CAsyncS

< a href ="http://simplesamples.info/MFC/CAsyncSocketUDPReceive.html\"target ="_ blank"> http://simplesamples.info/MFC/CAsyncSocketUDPReceive.html


< a name ="x_564f8bc8-7999-4331-acee-60ad0b6a2b21_CommunityBridge"title ="Mozilla / 5.0(Windows NT 6.1; WOW64; rv:31.0)Gecko / 20100101 Thunderbird / 31.7.0通过社区论坛NNTP Server 1.1.55.0">

Hi. I have searched throughout the internet. I can't find samples on UDP Broadcasting using CAsyncSocket. I don't want something like client giving request and server accepting it and then the sending and receiving starts. I want something like when the server application starts it should broadcast a port and listen for all the clients using the same port. When the client application starts it should not give request to server, it should send its IP address to the Server. Can someone give me some samples or links where I can find some samples? I have done this using c programming by creating socket. But I want to do this using CAsyncSocket. Pls help.

解决方案

On 6/8/2015 3:05 AM, Mencis wrote:

Hi. I have searched throughout the internet. I can't find samples on UDP Broadcasting using CAsyncSocket.

Weird. I searched through the internet, and found such samples within two minutes. Are we using different internets?

http://www.codeproject.com/Articles/16581/Sending-Receiving-UDP-Datagrams-with-MFC-s-CAsyncS
http://simplesamples.info/MFC/CAsyncSocketUDPReceive.html


这篇关于使用CAsyncSocket进行UDP广播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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