This commit is contained in:
Sergiy Poplavskyi 2018-04-24 16:25:33 -07:00
Родитель 607691ebaa
Коммит 38d3da162a
4 изменённых файлов: 102 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2037
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoRaWan.NetworkServer", "LoRaWan.NetworkServer\LoRaWan.NetworkServer.csproj", "{3567DA75-0971-467E-9F29-EB1ADFEA9381}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{46CFFE97-CD8C-4CEE-9881-ABE147D8CE18}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmdWrapper", "CmdWrapper\CmdWrapper.csproj", "{D40199A3-5BEB-40E8-B13E-F3250A807FBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3567DA75-0971-467E-9F29-EB1ADFEA9381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3567DA75-0971-467E-9F29-EB1ADFEA9381}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3567DA75-0971-467E-9F29-EB1ADFEA9381}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3567DA75-0971-467E-9F29-EB1ADFEA9381}.Release|Any CPU.Build.0 = Release|Any CPU
{D40199A3-5BEB-40E8-B13E-F3250A807FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D40199A3-5BEB-40E8-B13E-F3250A807FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D40199A3-5BEB-40E8-B13E-F3250A807FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D40199A3-5BEB-40E8-B13E-F3250A807FBC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D40199A3-5BEB-40E8-B13E-F3250A807FBC} = {46CFFE97-CD8C-4CEE-9881-ABE147D8CE18}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FD60E938-DB16-4486-8BEF-4F2CE460E71D}
EndGlobalSection
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 3
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://mandurledur.visualstudio.com/
SccLocalPath0 = .
SccProjectUniqueName1 = LoRaWan.NetworkServer\\LoRaWan.NetworkServer.csproj
SccProjectName1 = LoRaWan.NetworkServer
SccLocalPath1 = LoRaWan.NetworkServer
SccProjectUniqueName2 = CmdWrapper\\CmdWrapper.csproj
SccProjectTopLevelParentUniqueName2 = LoRaWan.NetworkServer.sln
SccProjectName2 = CmdWrapper
SccLocalPath2 = CmdWrapper
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace LoRaWan.NetworkServer
{
public class MessageProcessor
{
public void processMessage(byte[] message)
{
//Decrypting message
Console.WriteLine(Encoding.UTF8.GetString(message));
}
}
}

Просмотреть файл

@ -0,0 +1,23 @@
using System;
using System.Net.Sockets;
using System.Threading.Tasks;
namespace LoRaWan.NetworkServer
{
public class UdpServer
{
const int port = 1680;
public async void RunServer()
{
using (var udpClient = new UdpClient(port))
{
while (true)
{
UdpReceiveResult receivedResults = await udpClient.ReceiveAsync();
MessageProcessor messageProcessor = new MessageProcessor();
Task.Run(() => messageProcessor.processMessage(receivedResults.Buffer));
}
}
}
}
}