• 大小: 3.58MB
    文件类型: .rar
    金币: 2
    下载: 2 次
    发布日期: 2023-09-10
  • 语言: C#
  • 标签: C#网络  调试  转功能  

资源简介

C#网络调试助手,带中转功能

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace NetWork
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        IPAddress ip;
        IPEndPoint point = new IPEndPoint(IPAddress.Any0);
        IPAddress ip2;
        IPEndPoint point2 = new IPEndPoint(IPAddress.Any 0);
        string protocol;
        Socket aimSocket;
        Socket aimSocket2;
        Socket mySocket;
        UdpClient RecUdpClient;
        //IPEndPoint remote;
        private void Form1_Load(object sender EventArgs e)//初始化为UDP Server模式
        {
            cobProtocol.SelectedIndex = 0;
            txtIP.Text = GetAddressIP();
          //  txtIP2.Text = GetAddressIP();
            Control.CheckForIllegalCrossThreadCalls = false;
        }
        string GetAddressIP()
        {
            string AddressIP = ““;
            foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
            {
                if (_IPAddress.AddressFamily.ToString() == “InterNetwork“)
                {
                    AddressIP = _IPAddress.ToString();
                    ip = _IPAddress;//设定全局的IP
                }
            }
            return AddressIP;
        }
        Thread thReceive = null;
        private void btnStart_Click(object sender EventArgs e)//设置目标IP(Client),本地IP(Server)
        {
            try
            {
                if (protocol == “UDP Server“)
                {
                    if (btnStart.Text == “连接“)
                    {
                        btnStart.Text = “断开“;
                        aimSocket = new Socket(AddressFamily.InterNetwork SocketType.Dgram ProtocolType.Udp);
                        RecUdpClient = new UdpClient(new IPEndPoint(ip Convert.ToInt32(txtPort.Text)));
                       // MessageBox.Show(“UDP Server创建成功“);
                          thReceive = new Thread(USReceive);
                        thReceive.IsBackground = true;
                        thReceive.Start();
                 
                    }
                    else
                    {
                        if(thReceive!=null)
                        { 
                        thReceive.Abort();
                        btnStart.Text = “连接“;
                         }
                    }
                }
                else if (protocol == “UDP Client“)//UPD客户端,目标IP和端口  调用Socket.SendTo
                {
                    aimSocket = new Socket(AddressFamily.InterNetwork SocketType.Dgram ProtocolType.Udp);//建立通信的Socket
                    ip = IPAddress.Parse(txtIP.Text);
                    point = new IPEnd

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

    ..A..H.     47616  2017-07-05 17:02  NetWork\.vs\NetWork\v14\.suo

     文件        187  2015-09-18 10:57  NetWork\NetWork\App.config

     文件         64  2017-07-07 15:55  NetWork\NetWork\bin\Debug\app.ini

     文件      28672  2017-07-07 15:55  NetWork\NetWork\bin\Debug\NetWork.exe

     文件        187  2015-09-18 10:57  NetWork\NetWork\bin\Debug\NetWork.exe.config

     文件      48640  2017-07-07 15:55  NetWork\NetWork\bin\Debug\NetWork.pdb

     文件      22696  2017-07-07 15:59  NetWork\NetWork\bin\Debug\NetWork.vshost.exe

     文件        187  2015-09-18 10:57  NetWork\NetWork\bin\Debug\NetWork.vshost.exe.config

     文件        490  2015-06-04 12:48  NetWork\NetWork\bin\Debug\NetWork.vshost.exe.manifest

     文件      20328  2017-07-07 15:55  NetWork\NetWork\Form1.cs

     文件      19159  2017-07-07 15:55  NetWork\NetWork\Form1.Designer.cs

     文件       8595  2017-07-07 15:55  NetWork\NetWork\Form1.resx

     文件       3830  2017-07-04 15:52  NetWork\NetWork\NetWork.csproj

     文件      17261  2017-07-07 15:47  NetWork\NetWork\nginx.cs

     文件       1452  2017-07-04 16:27  NetWork\NetWork\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6991  2017-07-04 15:42  NetWork\NetWork\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1461  2017-07-07 15:59  NetWork\NetWork\obj\Debug\NetWork.csproj.FileListAbsolute.txt

     文件        976  2017-07-07 15:55  NetWork\NetWork\obj\Debug\NetWork.csproj.GenerateResource.Cache

     文件       2210  2017-07-04 10:24  NetWork\NetWork\obj\Debug\NetWork.csprojResolveAssemblyReference.cache

     文件      28672  2017-07-07 15:55  NetWork\NetWork\obj\Debug\NetWork.exe

     文件        180  2017-07-07 15:55  NetWork\NetWork\obj\Debug\NetWork.Form1.resources

     文件      48640  2017-07-07 15:55  NetWork\NetWork\obj\Debug\NetWork.pdb

     文件        180  2017-07-04 15:52  NetWork\NetWork\obj\Debug\NetWork.Properties.Resources.resources

     文件          0  2015-09-18 10:57  NetWork\NetWork\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2015-09-18 10:57  NetWork\NetWork\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2015-09-18 10:57  NetWork\NetWork\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       1661  2017-07-07 15:16  NetWork\NetWork\Program.cs

     文件       1356  2015-09-18 10:57  NetWork\NetWork\Properties\AssemblyInfo.cs

     文件       2866  2015-09-18 10:57  NetWork\NetWork\Properties\Resources.Designer.cs

     文件       5612  2015-09-18 10:57  NetWork\NetWork\Properties\Resources.resx

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

评论

共有 条评论