public void NotifyJoinService(Service service, Network network) { dynamic packet = new JObject(); packet.type = "notify_join_service"; packet.service = service.GetServiceName(); packet.id = service._id; packet.address = network.GetAddress(service); packet.port = service._port; this.SendPacket(packet); }
public dynamic GetServicesNetworkInfo(Network network) { dynamic packet = new JObject(); packet.type = "network_info"; packet.service = GetServicesName(); packet.network = new JArray(); //_servicesLock.EnterReadLock(); for (int i = 0; i <= _maxIndex; i++) { if(_services[i] == null) continue; byte[] host = network.GetAddress(_services[i]); if(host != null) packet.network.Add(host); } //_servicesLock.ExitReadLock(); return packet; }
public int NotifyJoinService(Service service, Network network) { int count = 0; //이제 연결된 서비스들에게 상태를 보고함. for (int i = 0; i <= _maxIndex; i++) { if(network.GetAddress(_services[i]) == null) continue; _services[i].NotifyJoinService(service, network); count++; } return count; }