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();
}
}
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();
}
}