今天上点干货出来,其实就是上学期的一个网络编程的作业,用Unity做的客户端,用C#直接写的服务端,代码是最简单的Socket编程,基本没有难的东西,不过如果像一年前的我那么菜的话(其实现在也超菜的)应该还是会有点用的。
这里就直接上源码了,真有看了还不会的可以评论哈。
服务端
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace SocketServer
{
class Program
{
public static List<Client> clientList = new List<Client>();
static void Main(string[] args)
{
So