/// <summary> /// 设置回调函数 /// </summary> /// <param name="prepareConnect"></param> /// <param name="connect"></param> /// <param name="send"></param> /// <param name="recv"></param> /// <param name="close"></param> /// <param name="error"></param> public virtual void SetCallback(OnPrepareConnect prepareConnect, OnConnect connect, OnSend send, OnPullReceive recv, OnClose close, OnError error) { // 设置 Socket 监听器回调函数 SetOnPullReceiveCallback(recv); base.SetCallback(prepareConnect, connect, send, null, close, error); }
public virtual void SetOnPrepareConnectCallback(OnPrepareConnect prepareConnect) { if (prepareConnect != null) { OnPrepareConnectCallback = new OnPrepareConnect(prepareConnect); SDK_OnPrepareConnectCallback = new HPSocketSdk.OnPrepareConnect(SDK_OnPrepareConnect); } else { OnPrepareConnectCallback = null; SDK_OnPrepareConnectCallback = null; } HPSocketSdk.HP_Set_FN_Client_OnPrepareConnect(pListener, SDK_OnPrepareConnectCallback); }
/////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// 设置回调函数 /// </summary> /// <param name="prepareConnect"></param> /// <param name="connect"></param> /// <param name="send"></param> /// <param name="recv"></param> /// <param name="close"></param> /// <param name="error"></param> public void SetCallback(OnPrepareConnect prepareConnect, OnConnect connect, OnSend send, OnReceive recv, OnClose close, OnError error) { if (IsSetCallback == true) { throw new Exception("已经调用过SetCallback()方法,如果您确定没手动调用过该方法,并想要手动设置各回调函数,请在构造该类构造函数中传false值,并再次调用该方法。"); } // 设置 Socket 监听器回调函数 SetOnPrepareConnectCallback(prepareConnect); SetOnConnectCallback(connect); SetOnSendCallback(send); SetOnReceiveCallback(recv); SetOnCloseCallback(close); SetOnErrorCallback(error); IsSetCallback = true; }
public static extern void HP_Set_FN_Client_OnPrepareConnect(IntPtr pListener, OnPrepareConnect fn);
public static extern void HP_Set_FN_Agent_OnPrepareConnect(IntPtr pListener, OnPrepareConnect fn);