Add remember me button and more
This commit is contained in:
3
Socket/App.config
Normal file
3
Socket/App.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
</configuration>
|
||||
33
Socket/EchoServer.cs
Normal file
33
Socket/EchoServer.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SocketServer {
|
||||
public class EchoServer {
|
||||
public void Start(int port = 9656) {
|
||||
IPEndPoint endPoint = new IPEndPoint(IPAddress.Loopback, port);
|
||||
Socket socket = new Socket(endPoint.AddressFamily, SocketType.Stream, SecurityProtocolType.Tcp);
|
||||
socket.Bind(endPoint);
|
||||
socket.Listen(128);
|
||||
_ = Task.Run(() => DoEcho(socket));
|
||||
}
|
||||
private async Task DoEcho(Socket socket) {
|
||||
while (true) {
|
||||
Socket clientSocket = await Task.Factory.FromAsync(
|
||||
new Func<AsyncCallback, object, IAsyncResult>(socket.BeginAccept),
|
||||
new Func<IAsyncResult, Socket>(socket.EndAccept),
|
||||
null).ConfigureAwait(false);
|
||||
using (NetworkStream nStream = new NetworkStream(clientSocket, true)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
while (true) {
|
||||
int bytesRead = await nStream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false);
|
||||
if (bytesRead == 0)
|
||||
break;
|
||||
await nStream.WriteAsync(buffer, 0, bytesRead).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Socket/Server.cs
Normal file
10
Socket/Server.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SocketServer {
|
||||
class Server {
|
||||
}
|
||||
}
|
||||
46
Socket/SocketServer.csproj
Normal file
46
Socket/SocketServer.csproj
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{31861EFE-4D24-489C-9615-A3B22FCB7041}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Socket</RootNamespace>
|
||||
<AssemblyName>Socket</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="EchoServer.cs" />
|
||||
<Compile Include="Server.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
||||
BIN
Socket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Normal file
BIN
Socket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Normal file
Binary file not shown.
1
Socket/obj/Debug/Socket.csproj.CoreCompileInputs.cache
Normal file
1
Socket/obj/Debug/Socket.csproj.CoreCompileInputs.cache
Normal file
@@ -0,0 +1 @@
|
||||
07442253ff0d2d71b56b29a5132f6fc63b7b6ee7
|
||||
2
Socket/obj/Debug/Socket.csproj.FileListAbsolute.txt
Normal file
2
Socket/obj/Debug/Socket.csproj.FileListAbsolute.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
C:\Users\Crylia\Documents\Git\Server Dashboard\Socket\obj\Debug\Socket.csprojAssemblyReference.cache
|
||||
C:\Users\Crylia\Documents\Git\Server Dashboard\Socket\obj\Debug\Socket.csproj.CoreCompileInputs.cache
|
||||
@@ -0,0 +1 @@
|
||||
07442253ff0d2d71b56b29a5132f6fc63b7b6ee7
|
||||
@@ -0,0 +1,2 @@
|
||||
C:\Users\Crylia\Documents\Git\Server Dashboard\Socket\obj\Debug\SocketServer.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Crylia\Documents\Git\Server Dashboard\Socket\obj\Debug\SocketServer.csprojAssemblyReference.cache
|
||||
BIN
Socket/obj/Debug/SocketServer.csprojAssemblyReference.cache
Normal file
BIN
Socket/obj/Debug/SocketServer.csprojAssemblyReference.cache
Normal file
Binary file not shown.
Reference in New Issue
Block a user