与C#的C ++服务器通信 [英] Communicate with a C++ server from C#

查看:92
本文介绍了与C#的C ++服务器通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C ++编写的服务器,使用UDP进行通信,我需要一个C#/ asp网站将数据发送到该服务器。有没有人知道如何做到这一点?



我尝试过:



尝试向IP发送消息,希望我可以在端口80上侦听并解析所有数据但无法正常工作。

I have a server written in C++ that communicates using UDP, I need a C#/asp website to send data to that server. Does anyone have an idea on how this could be done?

What I have tried:

Tried posting a message to the IP hoping that I could listen on port 80 and parse whatever data came in but that didn't work.

推荐答案

使用UDP在C#中进行简单的谷歌搜索可以解决您的问题。



UdpClient类(System.Net.Sockets) [ ^ ]



c# - 从同一套接字发送和接收数据的简单UDP示例 - Stack Overflow [ ^ ]



谷歌 [ ^ ]



除非你有一些代码,你实际上已经尝试并卡在某处,我建议你从上面的链接开始,做一些你的工作结束(不要指望我们为你做的工作),看看你是否可以按摩这些例子为了满足您的需求。



如果您真的试图自己解决问题而陷入困境,请随时回过头来清楚解释您的问题以及任何相关的代码示例,我相信您会得到更有意义的帮助。
A simple google search of communicating in C# using UDP would have resolved your issue.

UdpClient Class (System.Net.Sockets)[^]

c# - Simple UDP example to send and receive data from same socket - Stack Overflow[^]

Google[^]

Unless you have some code you've actually tried and gotten stuck somewhere, i suggest you start with the above links, do some work on your end (not expect us to do the work for you) and see if you can massage these examples to meet your needs.

Should you actually attempt to solve your issue on your own and get stuck somewhere, feel free to come back with a clear explanation of your issue and any relevant code samples and I am sure you will get more meaningful help.


这篇关于与C#的C ++服务器通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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