-
C# 指定主机和端口发消息的实现
Visual C# 指定主机和端口发消息的实现例子,支持和远程主机发送消息,本例子可学习到很多实用的网络方法的用法,以下代码是本功能的核心实现:
richTextBox1.Text = string.Empty;
//实例化UdpClient对象
UdpClient udpclient = new UdpClient(Convert.ToInt32(textBox2.Text));
//调用UdpClient对象的Connect建立默认远程主机
udpclient.Connect(textBox1.Text, Convert.ToInt32(textBox2.Text));
//定义一个字节数组,用来存放发送到远程主机的信息
Byte[] sendBytes = Encoding.Default.GetBytes(textBox3.Text);
//调用UdpClient对象的Send方法将Udp数据报发送到远程主机
udpclient.Send(sendBytes, sendBytes.Length);
//实例化IPEndPoint对象,用来显示响应主机的标识
IPEndPoint ipendpoint = new IPEndPoint(IPAddress.Any, 0);
//调用UdpClient对象的Receive方法获得从远程主机返回的Udp数据报
Byte[] receiveBytes = udpclient.Receive(ref ipendpoint);
//将获得的Udp数据报转换为字符串形式
string returnData = Encoding.Default.GetString(receiveBytes);
richTextBox1.Text = "接收到的信息:" + returnData.ToString();
//使用IPEndPoint对象的Address和Port属性获得响应主机的IP地址和端口号
richTextBox1.Text += "
这条信息来自主机" + ipendpoint.Address.ToString()
+ "上的" + ipendpoint.Port.ToString() + "端口";
//关闭UdpClient连接
- 2022-02-10 10:21:19下载
- 积分:1
-
motorcontrol
本代码是基于检测遥控飞机手柄输出的PWM信号频率,转换为角度信息,再作为步进电机移动输入量,最终实现使用遥控飞机手柄摇杆精确控制步进电机转动角度的目的,包含PWM频率检测模块和步进电机驱动模块等。(This code is PWM frequency signal detection based on the output of the remote control aircraft converted to handle, angle information, and then as the stepper motor movement input, and ultimately use the remote control aircraft joystick handle precise control of stepper motor rotation angle, including PWM frequency detection module and stepper motor drive module.)
- 2017-07-31 22:08:20下载
- 积分:1
-
《播放声音(DX》 C#中“使用 DirectX 播放声音文件”
《播放声音(DX》 C#中“使用 DirectX 播放声音文件”-"to play a sound (DX" C# "use DirectX play audio files"
- 2022-01-25 16:57:37下载
- 积分:1
-
stm32别踩白块
可在STM32通过驱动一块3.2寸的TFT液晶以及一个EXP2406驱动的电阻触摸屏,来实现一个别踩白块的小游戏。(The driving resistance of a 3.2 inch TFT LCD and a touch screen EXP2406 driver in STM32, to achieve a step on the white pieces of small game.)
- 2021-04-29 07:58:43下载
- 积分:1
-
C# 文件下载器 可以进行网络爬虫资源下载
一个Visual C#2012 编写的文件下载器 可以进行网络爬虫资源下载,源文件目录介绍:
MyDownloader.Spider是网络抓取资源的下载程序。
MyDownloader.IEPlugin是在IE中下载时的一个小补丁插件。
MyDownloader.Extension是一个下载插件的扩展程序,可用于IE或其它程序环境。
MyDownloader.Core是下载程序的核心代码
MyDownloader.App一个较小的扩展出来的APP项目源码
因环境和VS版本问题,编辑在上传源码前没有测试成功,如果有版本的话,应该可以编译成功,所需的DLL组件已为你打包。
- 2022-10-17 08:45:03下载
- 积分:1
-
正点原子mini版 DHT11温湿度采集
工程采用C语言在stm32下完成,使用的是正点原子的mini版进行实现,已通过调试
- 2023-03-13 15:40:03下载
- 积分:1
-
TMS320C6000
TMS320C6000的一些光盘资料和测试程序,希望可以帮到大家(Some discs TMS320C6000 information and testing procedures, hope to help everyone who want to learn DSP.)
- 2013-08-30 08:51:18下载
- 积分:1
-
BLE_ZLG
基于STM32的ZLG9021 BLE4.0蓝牙模块驱动程序。(ZLG9021 BLE4.0 bluetooth module driver based on STM32.)
- 2020-06-22 21:20:01下载
- 积分:1
-
即系
即系
- 2013-06-11下载
- 积分:1
-
PWM输出实验
通过定时器控制pwm输出,进而控制电机舵机的转动。(The output of PWM is controlled by a timer, and then the rotation of the motor steering gear is controlled.)
- 2020-06-18 17:20:02下载
- 积分:1