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();
        }
    }
  • 相关阅读:
    jmap使用
    Spring boot后台搭建一使用MyBatis集成Mapper和PageHelper
    aspose.slides for java去除水印
    win10 解决Failed installing 'Tomcat8' service
    NoSQL数据库
    windows下Java调用可执行文件
    Neo4j CQL基本使用
    初识Neo4j
    (原)下载pubFig的python代码
    (原+译)win7远程连接ubuntu16.04
  • 原文地址:https://www.cnblogs.com/bigmouthz/p/946783.html
Copyright © 2011-2022 走看看