Not able to find JmDNS service in other machines - bonjour

Using jmdns 3.4.1, I'm able to see the services advertised by the machines in the LAN, I can also create a service and register it, so that I can see it in my machine. However, when I create a new service in another machine of the LAN, I cannot see it in my machine.
I'm using the following code in the other machine:
service = ServiceInfo.create("_workstation._tcp.local.", "service1" ,80, "foobar");
jmdns = JmDNS.create();
jmdns.registerService(service);

That should be the problem of address.
When you create an object jmdns, it's better to add the inetaddress.
Example:
InetAddress Address = InetAddress.getLocalHost();
final JmDNS jmdns = JmDNS.create(Address);

Related

Configuring an IP address in Spring Boot admin client

I am using Spring Boot admin version 2.6.9 and using
spring.boot.admin.client.instance.prefer-ip=true
to register to admin server via an IP address. Now since I am running my apps inside Docker containers, the admin server receives Docker IP addresses and not the public IP addresses
of the applications.
I have tried changing management.address, but that does not work.
I can not use the Docker network to connect to these machines and I can not change the server.address property. I have tried the below properties as well, but they don’t show anything on the admin server apart from online status.
spring.boot.admin.client.instance.service-url=http://11.0.134.202:9999
spring.boot.admin.client.instance.management-url=http://11.212.134.202:9999
I got it working using
spring.boot.admin.client.instance.prefer-ip=true
spring.boot.admin.client.instance.service-url=http://127.0.0.1:9999
spring.boot.admin.client.instance.management-url=http://127.0.0.1:9999/actuator

How to access mongodb on GCE with GAE

I´ve deploy my demo app on GAE and works fine with mLab , but when I try to deploy mongodb on GCE (MongoDB (Google Click to Deploy) )the deploy is success but I don´t know how to get te URI to set on my app running on GAE.
I try with internal and external IP but it seems dont work !
Thanks
GAE Standard deployments are sand-boxed. Therefore you can not connect to GCE instances' internal IPs. You can imagine it as two different devices on two different private networks that are not capable to communicate with one another using their internal IPs. However, they can always communicate if one of the devices (GCE instance in this case) has a public IP, and it's private network (firewall) allowed traffic through the port required by the device.
On the other hand, if the GAE deployment is in flex environment, you should be able to connect to the db using the API through internal IPs.
I have tried and succeeded with this flex environment example for both internal and external IP addresses. Like you, I used Cloud Launcher to deploy Mongodb which created GCE instances with public IPs and network tags mongodb and mongodb-db. Then I created a db, username and a password by connecting to the primary db instance through SSH.
To use the internal IP, I just created/modified keys.json file per the example, as follows:
{
"mongoHost": "internal IP address",
"mongoPort": "27017",
"mongoDatabase": "db",
"mongoUser": "username",
"mongoPass": "password"
}
So I didn't have to worry about the URI as the code in server.js took care of it through passing this string:
mongodb://${user}:${pass}#${host}:${port}
But for your demo app, you may have to check the MongoDB official documentation for the standard connection string format URI.
As for using public IPs, I had to create a network firewall rule that allows tcp ingress on port 27017 with target tags identical to the network tags in order to limit access through the port to the MongoDB instances only. Next, I modified the keys.json file as above by replacing the internal IP with the public one.

apache camel - deploying with cxfs web service

I'm trying to deploy my camel app which on start is creating a cxfrs endpoint. The url is like this: http://localhost:9876 . When I try to hit this one on a rest client or anywhere within my machine it works. But when I try to access it using my phone or other external devices, I'm not able to connect.
Am I missing something?
TIA
Using localhost will mean it is only accessible to your local machine, using 0.0.0.0 instead should make it publicly accessible.
0.0.0.0 should bind all available network interface on your remote machine, but from your description, somehow it only bind to localhost|127.0.0.1 so only accessible from local machine, could you use
http://external.ip.address:9876/foo/FooService
instead to see if it helps?
Also, you can try to access other network service(for example start a tomcat on remote machine and see if you can access it from your local machine) from that remote machine to see if it works, this can determine if your DNS correct or if there's really no firewall between them.

JmDNS : Discover the same service on Multiple devices

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.

Connect Local Host from Web Service

I have a Laptop, with msSql sever 2005, and it is connected to my Wifi router which gets the internet. So My laptop get connected to internet. But I need to access my msSql Sever from internet to connect my webpage which I made using ASP.Net.
Please Help me... And please give a solution for this...
You'll need your IP adress to connect, then open the SQL-Port in your router. (default is 3306)
When you connect to the server just use your current ip adress.
Maybe you want a static ip or something like http://dyndns.org
you want to write web service and host that service in sql machine
First setup a static IP address on your laptop and after that you need to set up port forwarding in your router. This process differs slightly depending on your routers manufacturer and model.
After this is set up properly make sure that SQL Servers port is open on your laptops firewall.
By using Dynamic DNS you can point to your possibly changing IP address with static name so you don't have to change this constantly in your connection string.