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();
        }
    }
  • 相关阅读:
    104. 二叉树的最大深度
    Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
    python-admin管理后台
    django-cookies 和session
    django-关系映射
    django-关系映射 一对一 一对多 多对多
    django-Meta类
    django-orm聚合查询和原生数据库查询
    django-F对象、Q对象
    django-orm删除数据
  • 原文地址:https://www.cnblogs.com/bigmouthz/p/946783.html
Copyright © 2011-2022 走看看