• 大小: 0.06M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: C#  Socket  网络  

资源简介

socket客户端、服务端传送数据

注意:IP地址需要改成自己本地的ip地址,方可测试

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
#region 命名空间
using System.Net.Sockets;
using System.Net;
using System.Threading;
#endregion

namespace SocketClientConsole
{
    class Program
    {
        #region 控制台主函数
        /// 
        /// 控制台主函数
        /// 

        /// 
        static void Main(string[] args)
        {
            //主机IP
            IPEndPoint serverIP = new IPEndPoint(IPAddress.Parse(“192.168.1.77“) 8686);
            Console.WriteLine(“请选择连接方式:“);
            Console.WriteLine(“A.Tcp“);
            Console.WriteLine(“B.Udp“);
            ConsoleKey key;
            while (true)
            {
                key = Console.ReadKey(true).Key;
                if (key == Cons

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-24 20:13  Socket-Part1\
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\
     文件         899  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole.sln
     文件       15360  2013-04-30 08:32  Socket-Part1\SocketClientConsole\SocketClientConsole.suo
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\bin\
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\bin\Debug\
     文件        7168  2013-04-29 17:39  Socket-Part1\SocketClientConsole\SocketClientConsole\bin\Debug\SocketClientConsole.exe
     文件       17920  2013-04-29 17:39  Socket-Part1\SocketClientConsole\SocketClientConsole\bin\Debug\SocketClientConsole.pdb
     文件       11608  2013-04-30 08:29  Socket-Part1\SocketClientConsole\SocketClientConsole\bin\Debug\SocketClientConsole.vshost.exe
     文件         490  2010-03-17 22:39  Socket-Part1\SocketClientConsole\SocketClientConsole\bin\Debug\SocketClientConsole.vshost.exe.manifest
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\x86\
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\x86\Debug\
     文件        5105  2013-04-29 17:39  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件        1203  2013-04-30 08:29  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\x86\Debug\SocketClientConsole.csproj.FileListAbsolute.txt
     文件        7168  2013-04-29 17:39  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\x86\Debug\SocketClientConsole.exe
     文件       17920  2013-04-29 17:39  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\x86\Debug\SocketClientConsole.pdb
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\obj\x86\Debug\TempPE\
     文件        4938  2013-04-29 17:39  Socket-Part1\SocketClientConsole\SocketClientConsole\Program.cs
     目录           0  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\Properties\
     文件        1388  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\Properties\AssemblyInfo.cs
     文件        2207  2013-04-24 20:13  Socket-Part1\SocketClientConsole\SocketClientConsole\SocketClientConsole.csproj
     目录           0  2013-04-25 20:50  Socket-Part1\SocketServerConsole\
     目录           0  2013-04-25 20:50  Socket-Part1\SocketServerConsole\SocketServerConsole\
     文件         899  2013-04-25 20:50  Socket-Part1\SocketServerConsole\SocketServerConsole.sln
     文件       14336  2013-04-29 17:43  Socket-Part1\SocketServerConsole\SocketServerConsole.suo
     目录           0  2013-04-25 20:50  Socket-Part1\SocketServerConsole\SocketServerConsole\bin\
     目录           0  2013-04-25 20:50  Socket-Part1\SocketServerConsole\SocketServerConsole\bin\Debug\
     文件        7168  2013-04-29 16:22  Socket-Part1\SocketServerConsole\SocketServerConsole\bin\Debug\SocketServerConsole.exe
     文件       17920  2013-04-29 16:22  Socket-Part1\SocketServerConsole\SocketServerConsole\bin\Debug\SocketServerConsole.pdb
............此处省略14个文件信息

评论

共有 条评论