/// <summary> /// /// </summary> /// <param name="address"></param> /// <param name="port"></param> /// <param name="channel"></param> public void ListenAt(string address, ushort port, int channel) { string strParam = string.Format("{0};{1};{2}", channel, address, port); YASIO_NI.yasio_set_option(_service, (int)YASIO_NI.YEnums.YOPT_C_REMOTE_ENDPOINT, strParam); var reuseaddr = (int)YASIO_NI.YEnums.YCF_REUSEADDR; YASIO_NI.yasio_set_option(_service, (int)YASIO_NI.YEnums.YOPT_C_MOD_FLAGS, $"{channel};{reuseaddr};0"); ListenAt(channel); }
/// <summary> /// 设置网络选项 /// </summary> /// <param name="opt"> /// /// </param> /// <param name="strParam">use ';' to split parameters, such as "0;ip138.com;80</param> public void SetOption(YASIO_NI.YEnums opt, string strParam) { YASIO_NI.yasio_set_option(_service, (int)opt, strParam); }