private void on_ack_connect_gate() { var _pre_proxy = proxys[juggle.Imodule.current_ch]; var udp_ch = _udp_conn.connect(_udp_ip, _udp_port); _pre_proxy.bind_udpchannel(udp_ch); timer.addticktime(5 * 1000, _pre_proxy.heartbeats); timer.addticktime(10 * 1000, _pre_proxy.refresh_udp_link); if ((++_robot_num) < _max_robot_num) { var ch = _conn.connect(_ip, _port); var proxy = new client_proxy(ch); proxys.Add(ch, proxy); proxy.connect_server(service.timerservice.Tick); } else { log.log.operation(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "all robots connected"); } if (onConnectGate != null) { onConnectGate(); } }
public bool connect_server(Int64 tick) { try { var ch = _conn.connect(_ip, _port); var proxy = new client_proxy(ch); proxys.Add(ch, proxy); proxy.connect_server(tick); } catch (Exception) { return(false); } return(true); }
private void on_ack_connect_gate() { timer.addticktime(timer.Tick + 30 * 1000, proxys[juggle.Imodule.current_ch].heartbeats); if ((++_robot_num) < _max_robot_num) { var ch = _conn.connect(_ip, _port); var proxy = new client_proxy(ch); proxys.Add(ch, proxy); proxy.connect_server(timer.Tick); } else { Console.WriteLine("all robots connected"); } if (onConnectGate != null) { onConnectGate(); } }