static int Connect(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); ShibaInu.UdpSocket obj = (ShibaInu.UdpSocket)ToLua.CheckObject <ShibaInu.UdpSocket>(L, 1); string arg0 = ToLua.CheckString(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); uint arg2 = (uint)LuaDLL.luaL_checknumber(L, 4); obj.Connect(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// 连接到工具服务端,开始收集数据 /// </summary> /// <param name="host">Host.</param> /// <param name="port">Port.</param> /// <param name="isUDP">If set to <c>true</c> is UD.</param> public static void Begin(string host, int port, bool isUDP) { GameObject go = Common.go; LuaProfiler profiler = go.GetComponent <LuaProfiler>(); if (profiler == null) { profiler = go.AddComponent <LuaProfiler>(); } else { if (profiler.enabled) { return; } profiler.enabled = true; } s_isUDP = isUDP; if (isUDP) { if (s_udp == null) { s_udp = new UdpSocket { callback = EventCallback }; } s_udp.Connect(host, port, (uint)port); } else { if (s_tcp == null) { s_tcp = new TcpSocket { callback = EventCallback }; } s_tcp.Connect(host, port); } s_luaBegin.BeginPCall(); s_luaBegin.PCall(); s_luaBegin.EndPCall(); Logger.Log("Begin!", "LuaProfiler"); }