コード例 #1
0
ファイル: StartupTask.cs プロジェクト: lillo42/IoT
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            // 
            // TODO: Insert code to perform background work
            //
            // If you start any asynchronous methods here, prevent the task
            // from closing prematurely by using BackgroundTaskDeferral as
            // described in http://aka.ms/backgroundtaskdeferral
            //

            BackgroundTaskDeferral background = taskInstance.GetDeferral();

            var server = new ServerTcp(9000);
            server.OnError += Server_OnError;
            server.OnDataReceive += Server_OnDataReceive;

            ThreadPool.RunAsync(x =>
            {
                server.StartAsync();
            });
        }
コード例 #2
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            //
            // TODO: Insert code to perform background work
            //
            // If you start any asynchronous methods here, prevent the task
            // from closing prematurely by using BackgroundTaskDeferral as
            // described in http://aka.ms/backgroundtaskdeferral
            //

            BackgroundTaskDeferral background = taskInstance.GetDeferral();

            var server = new ServerTcp(9000);

            server.OnError       += Server_OnError;
            server.OnDataReceive += Server_OnDataReceive;

            ThreadPool.RunAsync(x =>
            {
                server.StartAsync();
            });
        }
コード例 #3
0
ファイル: StartupTask.cs プロジェクト: lillo42/IoT
 private void Server_OnError(ServerTcp sender, string args)
 {
 }
コード例 #4
0
ファイル: StartupTask.cs プロジェクト: lillo42/IoT
 private async void Server_OnDataReceive(ServerTcp sender, string args)
 {
     //Answear text Recive
     await sender.SendAsync(string.Concat("Text Recive:", args));
 }
コード例 #5
0
 private void Server_OnError(ServerTcp sender, string args)
 {
 }
コード例 #6
0
 private async void Server_OnDataReceive(ServerTcp sender, string args)
 {
     //Answear text Recive
     await sender.SendAsync(string.Concat("Text Recive:", args));
 }