JmDNS : Discover the same service on Multiple devices - jmdns

I am trying to use JmDNS to discover the services.
I am able to discover the service using the Sample Code given at the
When I add a service listener and invoke the addServiceListener, it properly identifies the service.
But, I have the same service running on more than one device. Now, I am wondering how I will be able to get the list of all the IP Address on which the service is running. I am only able to get the IP Address of one the devices.
And also what is the difference between JmDNS and JmmDNS?

See at the docs to learn what JmmDNS is: http://jmdns.sourceforge.net/apidocs/javax/jmdns/JmmDNS.html
To get all IP Addresses where the service is provided, you just need to add one listener for the service. It should be notified for every service available in the network.
So the method serviceAdded(ServiceEvent event) from the ServiceListener will be called multiple times. But you have to trigger that the service will be resolved and you have to actually save all IP addresses yourself.

Related

How to find all the available MIDI ports over network using CoreMIDI?

I am working on an app which needs to send Midi over wifi. I looked at CoreMIDI and the MIDINetworkSession class. I have set the default session's policy to .anyone and also enabled it. But I am not clear what to do next. I looked at PGMidi but it didn't list out the remote host's MIDI ports after making changes to the session.
What I want is a list of all the MIDI ports that I can connect to on the remote machine running MacOSX.
Is it even possible? Can someone please give me some hints?
I was able to figure it out. Here is what I did:
Scanning the remote service
Suppose my mac is running a MIDI session which is advertised over Bonjour. I used NetServiceBrowser to scan the local network and find out which server supports "_apple-midi._udp" service. Look at the documentation.. NetServiceBrowserDelegate receives a service in the delegate callbacks. Please note that the service object is not yet resolved against the DNS and therefore doesn't contain IP address of the host.
The next step is to resolve the service by using a NetServiceDelegate. The service object passed in the success delegate callback contains everything that is there to know about that service. So now, you have a list of IP addresses/hostnames and corresponding port numbers.
Sending MIDI
Create a MIDINetworkConnection instance using the ip address/hostname and the port number. It looks like a synchronous call, so may be it doesn't contact the server itself. Next, get all the midi devices and iterate over Entities and Destinations. Its given in this document

Access external IP address from service

Is it possible to get the external IP address for a POD? It doesn't appear to be populating in the environmental variables for a service, so I was wondering if there was another way to get that information.
Basically: I'm setting up a proftpd service, and it needs to send out its external ip as well as a port for passive communication. Right now, it's sending the local IP address which is causing FTP clients to fail.
The kubernetes service discovery mechanism (DNS or environment variable) doesn't populate the external IP.
One way to work around is to create a static IP first, then assign it to your service.
Or you can exec kubectl inside your cluster to get the external IP but that's nasty.

Can I force Eureka registrations to use an ip address instead of a hostname?

I have a standalone, embedded Eureka server powered by Spring Boot 1.2.0.RELEASE and Spring Cloud 1.0.0.RC1. I see services properly registering themselves in the dashboard, which is great. The status links are using the host name of the box they are running on. Unfortunately, we are using virtual machines and they don't register themselves in DNS, which means that the links are unresolvable. I started looking through the code but was unable to find a way to force the links to use the host's ip address instead. Having a broken dashboard is not the end of the world but I am afraid that once we start using Ribbon or Feign to contact services, those URLs will also use the host name and be unresolvable. Maybe what I am really asking is there a way to force the clients to register with an ip address instead of a host name? Any help is appreciated.
set eureka.instance.preferIpAddress=true as documented here

How to find IP of my server for Microsoft's Cloud

I created tcp ip application and published it to cloud of Microsoft, but for now I don't know how to find the IP of my server.
Or in another words, how can I find the IP at which implemented role was deployed?
Depends on whether you are trying to get the public IP or the private IP of the server.
If you want to reach this server from outside of the Azure network, then you are looking for the public IP. In this case you must define an InputEndpoint for your role. You'll be required to specify a FQDN for your app. You can find the IP address of this FQDN using the usual methods like tracert, ping, etc.
If you want to reach this server from within the Azure network, typically you'd want some other role in your tenant to communicate with this server, then you'd need to define an InternalEndpoint for your server. You can then use the ServiceRuntime library to discover the private endpoint of your role instance.
Enabling Communication for Role Instances in Windows Azure is an excellent resource to get a better understanding of how this works.

How to fix my amazon Ec-2 ip address

server running on Amazon Ec-2. The web-server acts as back end for my application. My application does a Rest call on the web-server to send or retrieve data.
I want to fix the web-server ip so that even if my web-server crashes or I restart the server I don't need to change the REST call of my application since the address will change in amazon.
My application is a mobile application, is there any way in which I can achieve this so that i can make my mobile application independent from back end .
I know there is something called Elastic Ip but I don't know what it is and how to use it.
thanks in advance.
Elastic IP provides an option to reserve IP address and assign it to your instance. This way you can always have the same IP and it is a right option for you. This article discusses some approaches on how to use them.
Also, it is free when you assign it to running instance, but you will have to pay for it monthly if you don't use it.
Update
The simple way to associate elastic IP with you instance is via console.
First allocate your address in Elastic IPs section of console
Then start your instance
Go back to Elastic IPs section, select address and click Associate Address. Then choose your running instance.