v.0.7 Server WORKS!!!!!!!

This commit is contained in:
Mootfrost777 2022-04-23 20:07:14 +03:00
parent 632b6b154e
commit e607085e72
60 changed files with 307 additions and 10 deletions

Binary file not shown.

Binary file not shown.

View file

@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bowling_Server", "Bowling_S
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetLib", "BowlingNetLib\NetLib.csproj", "{8F4FCE29-064E-45E4-AF43-87F31420EF2F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetLib", "BowlingNetLib\NetLib.csproj", "{8F4FCE29-064E-45E4-AF43-87F31420EF2F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{A3F442D5-C149-401F-BC5C-9BADED32E621}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -27,6 +29,10 @@ Global
{8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Debug|Any CPU.Build.0 = Debug|Any CPU {8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Release|Any CPU.ActiveCfg = Release|Any CPU {8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Release|Any CPU.Build.0 = Release|Any CPU {8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Release|Any CPU.Build.0 = Release|Any CPU
{A3F442D5-C149-401F-BC5C-9BADED32E621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3F442D5-C149-401F-BC5C-9BADED32E621}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3F442D5-C149-401F-BC5C-9BADED32E621}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3F442D5-C149-401F-BC5C-9BADED32E621}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -114,7 +114,7 @@ namespace Bowling
Connect connect = new Connect(); Connect connect = new Connect();
if (connect.ShowDialog() == DialogResult.OK) if (connect.ShowDialog() == DialogResult.OK)
{ {
gameState = GameState.Game; gameState = GameState.Menu;
player1 = new Player() { Name = connect.Name, Score = new List<int>() }; player1 = new Player() { Name = connect.Name, Score = new List<int>() };
NetLib.NetLib.IP = connect.IP; NetLib.NetLib.IP = connect.IP;
NetLib.NetLib.port = connect.Port; NetLib.NetLib.port = connect.Port;

View file

@ -15,7 +15,7 @@ namespace NetLib
public static void Connect() public static void Connect()
{ {
IPAddress ip = IPAddress.Parse(IP); IPAddress ip = Dns.GetHostAddresses(IP)[0];
IPEndPoint ipe = new IPEndPoint(ip, port); IPEndPoint ipe = new IPEndPoint(ip, port);
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(ipe); socket.Connect(ipe);

View file

@ -13,7 +13,6 @@ namespace Bowling_Server
{ {
static List<Player> players = new List<Player>(); static List<Player> players = new List<Player>();
private static Socket socket; private static Socket socket;
public static Random random;
static void Main(string[] args) static void Main(string[] args)
{ {
@ -85,6 +84,7 @@ namespace Bowling_Server
static void StartGame(List<Player> group) static void StartGame(List<Player> group)
{ {
Console.WriteLine("OK"); Console.WriteLine("OK");
CastOpponents(group); CastOpponents(group);
foreach (var player in group) foreach (var player in group)
@ -92,6 +92,9 @@ namespace Bowling_Server
Thread thread = new Thread(() => Thread thread = new Thread(() =>
{ {
byte[] data = new byte[1024]; byte[] data = new byte[1024];
player.socket.ReceiveTimeout = 60000;
try
{
while (true) while (true)
{ {
int dataLength = player.socket.Receive(data); int dataLength = player.socket.Receive(data);
@ -100,7 +103,19 @@ namespace Bowling_Server
CastOpponents(group); CastOpponents(group);
} }
} }
); catch
{
Console.WriteLine("Player disconnected");
if (group.IndexOf(player) == 1)
{
players.Add(group[0]);
}
else
{
players.Add(group[1]);
}
}
});
thread.Start(); thread.Start();
} }
} }

13
Test/Program.cs Normal file
View file

@ -0,0 +1,13 @@
using System;
using System.Net;
namespace Test
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine(Dns.GetHostAddresses("mootfrost.ru")[0]);
}
}
}

8
Test/Test.csproj Normal file
View file

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"Test/1.0.0": {
"runtime": {
"Test.dll": {}
}
}
}
},
"libraries": {
"Test/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Semejkin_AV\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Semejkin_AV\\.nuget\\packages"
]
}
}

View file

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}

View file

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]

View file

@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Test")]
[assembly: System.Reflection.AssemblyTitleAttribute("Test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Создано классом WriteCodeFragment MSBuild.

View file

@ -0,0 +1 @@
f6533ec0c338906e0f581238a326c04606b3059f

View file

@ -0,0 +1,3 @@
is_global = true
build_property.RootNamespace = Test
build_property.ProjectDir = C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\

Binary file not shown.

View file

@ -0,0 +1 @@
888bf9d461a4b4d8262376cf6b207220f62a1b4f

View file

@ -0,0 +1,14 @@
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\bin\Debug\netcoreapp3.1\Test.exe
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\bin\Debug\netcoreapp3.1\Test.deps.json
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\bin\Debug\netcoreapp3.1\Test.runtimeconfig.json
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\bin\Debug\netcoreapp3.1\Test.runtimeconfig.dev.json
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\bin\Debug\netcoreapp3.1\Test.dll
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\bin\Debug\netcoreapp3.1\Test.pdb
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.csproj.AssemblyReference.cache
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.GeneratedMSBuildEditorConfig.editorconfig
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.AssemblyInfoInputs.cache
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.AssemblyInfo.cs
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.csproj.CoreCompileInputs.cache
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.dll
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.pdb
C:\Users\Semejkin_AV\Documents\Github_repos\ProgtimeHack2022_Bowling\Test\obj\Debug\netcoreapp3.1\Test.genruntimeconfig.cache

Binary file not shown.

View file

@ -0,0 +1 @@
cf6a809174eb713435eea0664134528a06d2b76a

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,68 @@
{
"format": 1,
"restore": {
"C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\Test.csproj": {}
},
"projects": {
"C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\Test.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\Test.csproj",
"projectName": "Test",
"projectPath": "C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\Test.csproj",
"packagesPath": "C:\\Users\\Semejkin_AV\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Semejkin_AV\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"targetAlias": "netcoreapp3.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"targetAlias": "netcoreapp3.1",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.NETCore.App.Host.win-x64",
"version": "[3.1.23, 3.1.23]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.300-preview.22204.3\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(ExcludeRestorePackageImports)' != 'true'">
<RestoreSuccess Condition="'$(RestoreSuccess)' == ''">True</RestoreSuccess>
<RestoreTool Condition="'$(RestoreTool)' == ''">NuGet</RestoreTool>
<ProjectAssetsFile Condition="'$(ProjectAssetsFile)' == ''">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == ''">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition="'$(NuGetPackageFolders)' == ''">C:\Users\Semejkin_AV\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition="'$(NuGetProjectStyle)' == ''">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition="'$(NuGetToolVersion)' == ''">6.2.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition="'$(ExcludeRestorePackageImports)' != 'true'">
<SourceRoot Include="C:\Users\Semejkin_AV\.nuget\packages\" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View file

@ -0,0 +1,73 @@
{
"version": 3,
"targets": {
".NETCoreApp,Version=v3.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETCoreApp,Version=v3.1": []
},
"packageFolders": {
"C:\\Users\\Semejkin_AV\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\Test.csproj",
"projectName": "Test",
"projectPath": "C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\Test.csproj",
"packagesPath": "C:\\Users\\Semejkin_AV\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Semejkin_AV\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"targetAlias": "netcoreapp3.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"targetAlias": "netcoreapp3.1",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.NETCore.App.Host.win-x64",
"version": "[3.1.23, 3.1.23]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.300-preview.22204.3\\RuntimeIdentifierGraph.json"
}
}
}
}

View file

@ -0,0 +1,10 @@
{
"version": 2,
"dgSpecHash": "BEh5d9qXk9PtQezdq/2nEVWFOsPSR1oVjwUhtMfugQxH0a54MUMI06CPnCdjxEKu0guIGIy/EiGQCb1zqwwuWw==",
"success": true,
"projectFilePath": "C:\\Users\\Semejkin_AV\\Documents\\Github_repos\\ProgtimeHack2022_Bowling\\Test\\Test.csproj",
"expectedPackageFiles": [
"C:\\Users\\Semejkin_AV\\.nuget\\packages\\microsoft.netcore.app.host.win-x64\\3.1.23\\microsoft.netcore.app.host.win-x64.3.1.23.nupkg.sha512"
],
"logs": []
}