diff --git a/POP3Client/.vs/POP3Client/DesignTimeBuild/.dtbcache.v2 b/POP3Client/.vs/POP3Client/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000000000000000000000000000000000000..eccde1935d647a6c7dbe7f5010424c5c9ad87e9e Binary files /dev/null and b/POP3Client/.vs/POP3Client/DesignTimeBuild/.dtbcache.v2 differ diff --git a/POP3Client/.vs/POP3Client/v16/.suo b/POP3Client/.vs/POP3Client/v16/.suo new file mode 100644 index 0000000000000000000000000000000000000000..e747aa2e3755ae151177cc1e63372556ae938946 Binary files /dev/null and b/POP3Client/.vs/POP3Client/v16/.suo differ diff --git a/POP3Client/POP3Client.sln b/POP3Client/POP3Client.sln new file mode 100644 index 0000000000000000000000000000000000000000..5a37d737a3e6fbb5b1df9793201c586541c5e9b7 --- /dev/null +++ b/POP3Client/POP3Client.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31205.134 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "POP3Client", "POP3Client\POP3Client.csproj", "{EBFBFC4C-064C-4547-9CD0-39816C397571}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBFBFC4C-064C-4547-9CD0-39816C397571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBFBFC4C-064C-4547-9CD0-39816C397571}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBFBFC4C-064C-4547-9CD0-39816C397571}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBFBFC4C-064C-4547-9CD0-39816C397571}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3DA04815-9C58-42C3-82EE-79B75513A727} + EndGlobalSection +EndGlobal diff --git a/POP3Client/POP3Client/POP3Client.csproj b/POP3Client/POP3Client/POP3Client.csproj new file mode 100644 index 0000000000000000000000000000000000000000..c73e0d1692ab38cc8596bbd32ae080d903aaa778 --- /dev/null +++ b/POP3Client/POP3Client/POP3Client.csproj @@ -0,0 +1,8 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp3.1</TargetFramework> + </PropertyGroup> + +</Project> diff --git a/POP3Client/POP3Client/Program.cs b/POP3Client/POP3Client/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..ad1bb5abad939a07b58f431064c61ca10d4ff833 --- /dev/null +++ b/POP3Client/POP3Client/Program.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net.Sockets; +using System.IO; + + +namespace POP3Client +{ + class Program + { + static void Main(string[] args) + { + Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + try + { + socket.Connect("localhost", 110); + } + catch (Exception ex) + { + Console.Write("Virhe: " + ex.Message); + Console.ReadKey(); + return; + } + + NetworkStream ns = new NetworkStream(socket); + + StreamReader sr = new StreamReader(ns); + StreamWriter sw = new StreamWriter(ns); + + Boolean on = true; + String viesti = ""; + while (on) + { + // Luetaan + viesti = sr.ReadLine(); + Console.WriteLine(viesti); + String[] status = viesti.Split(' '); + + switch(status[0]) + { + case "+OK": + + break; + default: + break; + } + } + + + Console.ReadKey(); + + sw.Close(); + sr.Close(); + ns.Close(); + socket.Close(); + } + } +} diff --git a/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.deps.json b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.deps.json new file mode 100644 index 0000000000000000000000000000000000000000..3184774b529e5c502521e70823d3511207fdcec9 --- /dev/null +++ b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v3.1", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v3.1": { + "POP3Client/1.0.0": { + "runtime": { + "POP3Client.dll": {} + } + } + } + }, + "libraries": { + "POP3Client/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.dll b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.dll new file mode 100644 index 0000000000000000000000000000000000000000..be2b424004bcd2b43c1a7704df9ae7b1b7de1694 Binary files /dev/null and b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.dll differ diff --git a/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.exe b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.exe new file mode 100644 index 0000000000000000000000000000000000000000..032c1604e76aec72b140b2176b215c60a458c22a Binary files /dev/null and b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.exe differ diff --git a/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.pdb b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.pdb new file mode 100644 index 0000000000000000000000000000000000000000..30b24af464701f999187f9be29734bc5f668fba3 Binary files /dev/null and b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.pdb differ diff --git a/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.runtimeconfig.dev.json b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.runtimeconfig.dev.json new file mode 100644 index 0000000000000000000000000000000000000000..9c9aff74d0f5c5b745a7d98df0d03319b4b012c4 --- /dev/null +++ b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.runtimeconfig.dev.json @@ -0,0 +1,8 @@ +{ + "runtimeOptions": { + "additionalProbingPaths": [ + "C:\\Users\\Joppe\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\Joppe\\.nuget\\packages" + ] + } +} \ No newline at end of file diff --git a/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.runtimeconfig.json b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.runtimeconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..bc456d7868bb54ec1809da30e339cd43f0a8a09c --- /dev/null +++ b/POP3Client/POP3Client/bin/Debug/netcoreapp3.1/POP3Client.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "netcoreapp3.1", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "3.1.0" + } + } +} \ No newline at end of file diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs new file mode 100644 index 0000000000000000000000000000000000000000..ad8dfe1a6310302587a2d0c0111d81b250eb4105 --- /dev/null +++ b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// <autogenerated /> +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.AssemblyInfo.cs b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..e9712d6c02473a2321d8bc3c25e2e3698fc80ab7 --- /dev/null +++ b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("POP3Client")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("POP3Client")] +[assembly: System.Reflection.AssemblyTitleAttribute("POP3Client")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.AssemblyInfoInputs.cache b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.AssemblyInfoInputs.cache new file mode 100644 index 0000000000000000000000000000000000000000..3fcea09a9fa5c05a743f2b7ab97522fc4222c2db --- /dev/null +++ b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +916f2515fefd86ae0f3f5620f187e691ec1e1c60 diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.assets.cache b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..6dbab37062f247e85677f14644cdf11951de9b01 Binary files /dev/null and b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.assets.cache differ diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csproj.CoreCompileInputs.cache b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000000000000000000000000000000000000..d078cee873d4dbb7db1f786bbd28d18391892332 --- /dev/null +++ b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +ba938b7afaf50dc7b9bf1e93516b7840bc9053d1 diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csproj.FileListAbsolute.txt b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csproj.FileListAbsolute.txt new file mode 100644 index 0000000000000000000000000000000000000000..1674f1314651c7a830dcc77565a66ec2ed619570 --- /dev/null +++ b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csproj.FileListAbsolute.txt @@ -0,0 +1,13 @@ +E:\Kurssit\ties323\POP3Client\POP3Client\bin\Debug\netcoreapp3.1\POP3Client.exe +E:\Kurssit\ties323\POP3Client\POP3Client\bin\Debug\netcoreapp3.1\POP3Client.deps.json +E:\Kurssit\ties323\POP3Client\POP3Client\bin\Debug\netcoreapp3.1\POP3Client.runtimeconfig.json +E:\Kurssit\ties323\POP3Client\POP3Client\bin\Debug\netcoreapp3.1\POP3Client.runtimeconfig.dev.json +E:\Kurssit\ties323\POP3Client\POP3Client\bin\Debug\netcoreapp3.1\POP3Client.dll +E:\Kurssit\ties323\POP3Client\POP3Client\bin\Debug\netcoreapp3.1\POP3Client.pdb +E:\Kurssit\ties323\POP3Client\POP3Client\obj\Debug\netcoreapp3.1\POP3Client.csprojAssemblyReference.cache +E:\Kurssit\ties323\POP3Client\POP3Client\obj\Debug\netcoreapp3.1\POP3Client.AssemblyInfoInputs.cache +E:\Kurssit\ties323\POP3Client\POP3Client\obj\Debug\netcoreapp3.1\POP3Client.AssemblyInfo.cs +E:\Kurssit\ties323\POP3Client\POP3Client\obj\Debug\netcoreapp3.1\POP3Client.csproj.CoreCompileInputs.cache +E:\Kurssit\ties323\POP3Client\POP3Client\obj\Debug\netcoreapp3.1\POP3Client.dll +E:\Kurssit\ties323\POP3Client\POP3Client\obj\Debug\netcoreapp3.1\POP3Client.pdb +E:\Kurssit\ties323\POP3Client\POP3Client\obj\Debug\netcoreapp3.1\POP3Client.genruntimeconfig.cache diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csprojAssemblyReference.cache b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csprojAssemblyReference.cache new file mode 100644 index 0000000000000000000000000000000000000000..74fe67b1ca671095970d4a7fbcae2417231e8f41 Binary files /dev/null and b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.csprojAssemblyReference.cache differ diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.dll b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.dll new file mode 100644 index 0000000000000000000000000000000000000000..be2b424004bcd2b43c1a7704df9ae7b1b7de1694 Binary files /dev/null and b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.dll differ diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.genruntimeconfig.cache b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.genruntimeconfig.cache new file mode 100644 index 0000000000000000000000000000000000000000..dc7f47f93258922e3f0032adc6719edd1daa6f17 --- /dev/null +++ b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.genruntimeconfig.cache @@ -0,0 +1 @@ +f05d1b480575433b5d159befbb569099130e543f diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.pdb b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.pdb new file mode 100644 index 0000000000000000000000000000000000000000..30b24af464701f999187f9be29734bc5f668fba3 Binary files /dev/null and b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/POP3Client.pdb differ diff --git a/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/apphost.exe b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/apphost.exe new file mode 100644 index 0000000000000000000000000000000000000000..032c1604e76aec72b140b2176b215c60a458c22a Binary files /dev/null and b/POP3Client/POP3Client/obj/Debug/netcoreapp3.1/apphost.exe differ diff --git a/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.dgspec.json b/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.dgspec.json new file mode 100644 index 0000000000000000000000000000000000000000..50db21c8bfdf2f526b75e67acdec93a44eaa5113 --- /dev/null +++ b/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.dgspec.json @@ -0,0 +1,62 @@ +{ + "format": 1, + "restore": { + "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\POP3Client.csproj": {} + }, + "projects": { + "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\POP3Client.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\POP3Client.csproj", + "projectName": "POP3Client", + "projectPath": "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\POP3Client.csproj", + "packagesPath": "C:\\Users\\Joppe\\.nuget\\packages\\", + "outputPath": "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Joppe\\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, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.202\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.g.props b/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.g.props new file mode 100644 index 0000000000000000000000000000000000000000..84f1eb192295b24b36bd8e55d6e1a138089562da --- /dev/null +++ b/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.g.props @@ -0,0 +1,18 @@ +<?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\Joppe\.nuget\packages\</NuGetPackageFolders> + <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> + <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.9.1</NuGetToolVersion> + </PropertyGroup> + <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> + <SourceRoot Include="C:\Users\Joppe\.nuget\packages\" /> + </ItemGroup> + <PropertyGroup> + <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.g.targets b/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.g.targets new file mode 100644 index 0000000000000000000000000000000000000000..53cfaa19b16f3769b2bfc33db3b5c0053c16fdba --- /dev/null +++ b/POP3Client/POP3Client/obj/POP3Client.csproj.nuget.g.targets @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/POP3Client/POP3Client/obj/project.assets.json b/POP3Client/POP3Client/obj/project.assets.json new file mode 100644 index 0000000000000000000000000000000000000000..7d21a0ab400746316e95b1bd4de874cfb5370ecc --- /dev/null +++ b/POP3Client/POP3Client/obj/project.assets.json @@ -0,0 +1,67 @@ +{ + "version": 3, + "targets": { + ".NETCoreApp,Version=v3.1": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + ".NETCoreApp,Version=v3.1": [] + }, + "packageFolders": { + "C:\\Users\\Joppe\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\POP3Client.csproj", + "projectName": "POP3Client", + "projectPath": "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\POP3Client.csproj", + "packagesPath": "C:\\Users\\Joppe\\.nuget\\packages\\", + "outputPath": "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\Joppe\\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, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.202\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/POP3Client/POP3Client/obj/project.nuget.cache b/POP3Client/POP3Client/obj/project.nuget.cache new file mode 100644 index 0000000000000000000000000000000000000000..24602f7715dc34ab112961d054d95bb355b1c10a --- /dev/null +++ b/POP3Client/POP3Client/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "geafbx5SPYvlw920Ax+ksL7ZSv5VPf17WSt/fNOWoMtxBKKQ9YsXGZKJMXrkybg6ZQbhpaQ05MNexKqWzlNA3Q==", + "success": true, + "projectFilePath": "E:\\Kurssit\\ties323\\POP3Client\\POP3Client\\POP3Client.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/STMPServer/.vs/STMPServer/v16/.suo b/STMPServer/.vs/STMPServer/v16/.suo index b13e2c5990018f47e07d8759397018f2098750b2..4f7957055f4b1f1b3fbe5d4ec07bc9b18eeb5858 100644 Binary files a/STMPServer/.vs/STMPServer/v16/.suo and b/STMPServer/.vs/STMPServer/v16/.suo differ diff --git a/STMPServer/STMPServer/Program.cs b/STMPServer/STMPServer/Program.cs index 0e7f9f46b1977c14ef188ff4fbca974b9b560fb9..dbfda906061c4fac74a0324185c3730848dec414 100644 --- a/STMPServer/STMPServer/Program.cs +++ b/STMPServer/STMPServer/Program.cs @@ -2,6 +2,7 @@ using System.Net; using System.Net.Sockets; using System.Text; +using System.Threading.Tasks; namespace STMPServer { @@ -9,60 +10,109 @@ namespace STMPServer { static void Main(string[] args) { - int port = 25000; - Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - IPEndPoint iep = new IPEndPoint(IPAddress.Loopback, port); - socket.Bind(iep); - // Kuinka monta asiakasta saa olla - socket.Listen(1); - bool while_on = true; - Console.WriteLine("SMTP Palvelin käynnissä portissa: " + port); - while(while_on) + //int[] ports = new int[] { 25000, 110 }; + int[] ports = new int[] { 110 }; // testing purposes + for (int i = 0; i < ports.Length; i++) { - Socket asiakas = socket.Accept(); - string ip = ((IPEndPoint)(asiakas.RemoteEndPoint)).Address.ToString(); - string asiakas_port = ((IPEndPoint)(asiakas.RemoteEndPoint)).Port.ToString(); - Console.WriteLine("Uusi asiakas: {0} portista: {1}", ip, asiakas_port); - // Aloitetaan keskustelu - asiakas.Send(Encoding.UTF8.GetBytes("220 TIES323 Postipalvelin\r\n")); - bool keskustelu = true; - bool data_vipu = false; - while(keskustelu) + Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IPEndPoint iep = new IPEndPoint(IPAddress.Loopback, ports[i]); + socket.Bind(iep); + + // Kuinka monta asiakasta saa olla + socket.Listen(1); + bool while_on = true; + Console.WriteLine("SMTP Palvelin käynnissä portissa: " + ports[i]); + + while (while_on) + { + // Tähän joku timeout ?? + // HandleSMTPClient(socket); + HandlePOP3Client(socket); + } + Console.ReadKey(); + socket.Close(); + } + } + + enum POPTila : UInt16 + { + Aloitus = 0, + Authorization = 1, + } + + + static void HandlePOP3Client(Socket socket) + { + Socket asiakas = socket.Accept(); + string ip = ((IPEndPoint)(asiakas.RemoteEndPoint)).Address.ToString(); + string asiakas_port = ((IPEndPoint)(asiakas.RemoteEndPoint)).Port.ToString(); + Console.WriteLine("Uusi asiakas: {0} portista: {1}", ip, asiakas_port); + + POPTila tila = POPTila.Aloitus; + bool keskustelu = true; + + // 10min timeout jos ei vastaa? + while(keskustelu) + { + switch(tila) { - byte[] buffer = new byte[2048]; - asiakas.Receive(buffer); - string asiakas_vastaus = Encoding.UTF8.GetString(buffer); - Console.WriteLine("[{0}:{1}]: {2}",ip,asiakas_port,asiakas_vastaus); - string[] lines = asiakas_vastaus.Split( - new[] { "\r\n", "\r", "\n" }, - StringSplitOptions.None - ); + case POPTila.Aloitus: + VastaaAsiakas("+OK TIES323 POP3 server ready", asiakas); + tila = POPTila.Authorization; + break; + case POPTila.Authorization: + + break; + default: + break; + } + } + } - int tila = 0; - if(data_vipu) - { - tila = ValidoiData(lines, asiakas); - } else - { - tila = ValidoiVastaus(lines[0], asiakas, data_vipu); - } - switch (tila) - { - case 1: - data_vipu = true; - break; - case 2: - asiakas.Close(); - keskustelu = false; - break; - default: - data_vipu = false; - break; - } + static void HandleSMTPClient(Socket socket) + { + Socket asiakas = socket.Accept(); + string ip = ((IPEndPoint)(asiakas.RemoteEndPoint)).Address.ToString(); + string asiakas_port = ((IPEndPoint)(asiakas.RemoteEndPoint)).Port.ToString(); + Console.WriteLine("Uusi asiakas: {0} portista: {1}", ip, asiakas_port); + // Aloitetaan keskustelu + asiakas.Send(Encoding.UTF8.GetBytes("220 TIES323 Postipalvelin\r\n")); + bool keskustelu = true; + bool data_vipu = false; + while (keskustelu) + { + byte[] buffer = new byte[2048]; + asiakas.Receive(buffer); + string asiakas_vastaus = Encoding.UTF8.GetString(buffer); + Console.WriteLine("[{0}:{1}]: {2}", ip, asiakas_port, asiakas_vastaus); + string[] lines = asiakas_vastaus.Split( + new[] { "\r\n", "\r", "\n" }, + StringSplitOptions.None + ); + + int tila = 0; + if (data_vipu) + { + tila = ValidoiData(lines, asiakas); + } + else + { + tila = ValidoiVastaus(lines[0], asiakas, data_vipu); + } + switch (tila) + { + case 1: + data_vipu = true; + break; + case 2: + asiakas.Close(); + keskustelu = false; + break; + default: + data_vipu = false; + break; } } - Console.ReadKey(); - socket.Close(); } static int ValidoiVastaus(string vastaus, Socket socket, bool data_vipu) diff --git a/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.dll b/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.dll index 67c554813fd6261cd458b36d1f56e9732f11808b..55c81807d296d53e590866fff8442787af2bd4b3 100644 Binary files a/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.dll and b/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.dll differ diff --git a/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.pdb b/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.pdb index 5d51eaa7cd0769c9b8a3aa41644209d34fd38377..3d7bfb6f35cd2a39592bc6d6bf2efc9bc2170e14 100644 Binary files a/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.pdb and b/STMPServer/STMPServer/bin/Debug/netcoreapp3.1/STMPServer.pdb differ diff --git a/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.csprojAssemblyReference.cache b/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.csprojAssemblyReference.cache index e84921a470a178d6c34a6d16975b66db84b52171..475e9f25ddab19c98e99fb9760c6360cd0369394 100644 Binary files a/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.csprojAssemblyReference.cache and b/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.csprojAssemblyReference.cache differ diff --git a/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.dll b/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.dll index 67c554813fd6261cd458b36d1f56e9732f11808b..55c81807d296d53e590866fff8442787af2bd4b3 100644 Binary files a/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.dll and b/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.dll differ diff --git a/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.pdb b/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.pdb index 5d51eaa7cd0769c9b8a3aa41644209d34fd38377..3d7bfb6f35cd2a39592bc6d6bf2efc9bc2170e14 100644 Binary files a/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.pdb and b/STMPServer/STMPServer/obj/Debug/netcoreapp3.1/STMPServer.pdb differ