• 大小: 0.04M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: udp通讯  

资源简介

C# udp通讯入门示例代码

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            UdpClient receivingUdpClient = new UdpClient(11000);
            IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any 0);
            try
            {
                byte[] sdata = Encoding.ASCII.GetBytes(“dkasfjkdsjf“);
                IPAddress ipa = IPAddress.Parse(“172.16.0.73“);
                receivingUdpClient.Receive(ref RemoteIpEndPoint);
                Console.WriteLine(“远程:{0}“ RemoteIpEndPoint.ToString());
                while (true)
                {
                    receivingUdpClient.Send(sda

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5632  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe

     文件      11776  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb

     文件      11600  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe

     文件        490  2014-01-13 21:31  简单的udp通讯\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.manifest

     文件       2459  2015-12-21 10:12  简单的udp通讯\ConsoleApplication1\ConsoleApplication1.csproj

     文件        432  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\obj\x86\Debug\ConsoleApplication1.csproj.FileListAbsolute.txt

     文件       5632  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\obj\x86\Debug\ConsoleApplication1.exe

     文件      11776  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\obj\x86\Debug\ConsoleApplication1.pdb

     文件       5934  2016-01-21 10:06  简单的udp通讯\ConsoleApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1189  2015-12-21 10:12  简单的udp通讯\ConsoleApplication1\Program.cs

     文件       1388  2015-12-21 10:07  简单的udp通讯\ConsoleApplication1\Properties\AssemblyInfo.cs

     文件       1378  2015-12-21 10:08  简单的udp通讯\ConsoleApplication1.sln

    ..A..H.     22528  2016-01-21 10:07  简单的udp通讯\ConsoleApplication1.suo

     文件       5120  2015-12-21 10:10  简单的udp通讯\ConsoleApplication2\bin\Debug\ConsoleApplication2.exe

     文件      13824  2015-12-21 10:10  简单的udp通讯\ConsoleApplication2\bin\Debug\ConsoleApplication2.pdb

     文件      11600  2016-01-21 10:05  简单的udp通讯\ConsoleApplication2\bin\Debug\ConsoleApplication2.vshost.exe

     文件        490  2014-01-13 21:31  简单的udp通讯\ConsoleApplication2\bin\Debug\ConsoleApplication2.vshost.exe.manifest

     文件       2459  2015-12-21 10:08  简单的udp通讯\ConsoleApplication2\ConsoleApplication2.csproj

     文件        882  2016-01-21 10:06  简单的udp通讯\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.csproj.FileListAbsolute.txt

     文件       5120  2015-12-21 10:10  简单的udp通讯\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.exe

     文件      13824  2015-12-21 10:10  简单的udp通讯\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.pdb

     文件       5934  2016-01-21 10:06  简单的udp通讯\ConsoleApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        924  2015-12-21 10:10  简单的udp通讯\ConsoleApplication2\Program.cs

     文件       1388  2015-12-21 10:08  简单的udp通讯\ConsoleApplication2\Properties\AssemblyInfo.cs

     目录          0  2015-12-21 10:07  简单的udp通讯\ConsoleApplication1\obj\x86\Debug\TempPE

     目录          0  2015-12-21 10:08  简单的udp通讯\ConsoleApplication2\obj\x86\Debug\TempPE

     目录          0  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\obj\x86\Debug

     目录          0  2015-12-21 10:10  简单的udp通讯\ConsoleApplication2\obj\x86\Debug

     目录          0  2015-12-21 10:16  简单的udp通讯\ConsoleApplication1\bin\Debug

     目录          0  2015-12-21 10:07  简单的udp通讯\ConsoleApplication1\obj\x86

............此处省略14个文件信息

评论

共有 条评论