zoukankan      html  css  js  c++  java
  • Common.TcpLib delegate interface

    using System;
    using System.Text;
    using System.Collections;
    using System.Collections.Generic;
    using System.Net;
    using System.Net.Sockets;
    using System.Threading;
    using System.Runtime.InteropServices;

    namespace Common.TcpLib
    {

        public enum ErrorType { MaxConnect, Catch, DisConnect, DisAccept };

        #region delegate
        //Tcp
        //服务端专用
        public delegate void _Bgz_OnBindEventDelegate(_Bgz_ConnectionState state);
        public delegate void _Bgz_OnAcceptEventDelegate(_Bgz_ConnectionState state);
        public delegate void _Bgz_OnDropConnectEventDelegate(_Bgz_ConnectionState state);
        //客户端专用
        public delegate void _Bgz_OnConnectEventDelegate(_Bgz_ConnectionState state);
        //公用
        public delegate void _Bgz_OnErrorEventDelegate(ErrorType errortype, string errormsg, _Bgz_ConnectionState state);
        public delegate void _Bgz_OnReceiveBeginEventDelegate(_Bgz_ConnectionState state);
        public delegate void _Bgz_OnReceiveingEventDelegate(_Bgz_ConnectionState state);
        public delegate void _Bgz_OnReceiveEndEventDelegate(_Bgz_ConnectionState state);


     
        #endregion


    }

    using System;
    namespace Common.TcpLib
    {
        interface ITcpClient
        {
            int BufferSize { get; }
            bool Debug { get; set; }

            void Connect();

            void Send(byte[] msg);
            void SendAsync(byte[] msg);
            void SendAsync(System.IO.Stream Astream);

            void Stop();
        }
    }

    using System;
    namespace Common.TcpLib
    {
        interface ITcpServer
        {
            int BackLog { get; }
            int BufferSize { get; }
            bool Debug { get; set; }
            System.Net.Sockets.Socket[] ClientSockets { get;}
           
            void Send(byte[] msg);
            void Send(System.Net.Sockets.Socket ClientSocket, byte[] msg);
            void SendAsync(System.Net.Sockets.Socket ClientSocket, byte[] msg);
            void SendAsync(System.Net.Sockets.Socket ClientSocket, System.IO.Stream Astream);
           
            void Start();
            void Start(bool optionValue);
           
            void Stop();
        }
    }
  • 相关阅读:
    WSL 修改默认登录用户为root
    WSL ssh服务自启动
    odoo 获取model的所有字段
    C++类型父类与子类的转换--dynamic_cast(转)
    开源软件/镜像库
    C/C++编译器gcc的windows版本MinGW-w64安装教程(转)
    msys2 环境搭建
    Windows下利用Cygwin搭建C/C++开发环境GCC(转)
    模板类中子类访问父类中的成员需要通过this指针
    C++ 构造函数与this指针
  • 原文地址:https://www.cnblogs.com/bigmouthz/p/946783.html
Copyright © 2011-2022 走看看