DotNetty学习(六)——进阶学习Socket和WebSocket互通

总览链接:

https://blog.csdn.net/a1234012340a/article/details/91040073


经过前面得学习。基本上可以简单编写socket通信和websocket通信

现在提出一个需求。要求websocket和socket进行通信

那么这个怎么进行思考呢?

1.首先需要让两种客户端同时连接至服务器

2.进行通信

就这么简单

下面详细得讲解一下两种方式如何同时连接一个服务端

首先基础代码

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace WebSocketCommunication
{
    using System;
    using System.IO;
    using System.Net;
    using System.Runtime;
    using System.Runtime.InteropServices;
    using System.Security.Cryptography.X509Certificates;
    using System.Threading.Tasks;
    using DotNetty.Buffers;
    using DotNetty.Codecs;
    using DotNetty.Codecs.Http;
    using DotNetty.Common;
    using DotNetty.Handlers.Tls;
    using DotNetty.Transport.Bootstrapp
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章