Socket
This commit is contained in:
10
Socket/Client/Client.csproj
Normal file
10
Socket/Client/Client.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
17
Socket/Client/Program.cs
Normal file
17
Socket/Client/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Client;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 20000);
|
||||
clientSocket.Connect(endPoint);
|
||||
}
|
||||
}
|
||||
}
|
20
Socket/Server/Program.cs
Normal file
20
Socket/Server/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Server;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 20000);
|
||||
serverSocket.Bind(endPoint);
|
||||
|
||||
serverSocket.Listen(20);
|
||||
|
||||
//Socket clientSocket = serverSocket.Accept();
|
||||
|
||||
//Console.WriteLine($"Connected. ({clientSocket.RemoteEndPoint})");
|
||||
}
|
||||
}
|
10
Socket/Server/Server.csproj
Normal file
10
Socket/Server/Server.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
31
Socket/Socket.sln
Normal file
31
Socket/Socket.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32929.385
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{4AAA9E91-21D1-46D6-A871-A4F0EF3DE8DD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{5EEB261C-98C2-4467-9CC3-2129F0031114}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4AAA9E91-21D1-46D6-A871-A4F0EF3DE8DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4AAA9E91-21D1-46D6-A871-A4F0EF3DE8DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4AAA9E91-21D1-46D6-A871-A4F0EF3DE8DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4AAA9E91-21D1-46D6-A871-A4F0EF3DE8DD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5EEB261C-98C2-4467-9CC3-2129F0031114}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5EEB261C-98C2-4467-9CC3-2129F0031114}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5EEB261C-98C2-4467-9CC3-2129F0031114}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5EEB261C-98C2-4467-9CC3-2129F0031114}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {819BF514-6C4B-49BD-A8B2-1ADD0D2C91E8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
10
Socket/Socket/Program.cs
Normal file
10
Socket/Socket/Program.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Socket
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
||||
}
|
10
Socket/Socket/Socket.csproj
Normal file
10
Socket/Socket/Socket.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Reference in New Issue
Block a user