I cannot connect to a couchbase server that runs on a different computer of the same local network.
The machine has the IP address 192.168.1.150. I use the official hello-couchbase tutorial for the Java SDK. Thus, my code looks like this:
Cluster cluster = CouchbaseCluster.create("192.168.1.150");
Bucket bucket = cluster.openBucket();
The second line triggers:
com.couchbase.client.deps.io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.1.150:11210
Is there any way to narrow down the reason for the connection failure? The webclient on localhost:8091 (in a browser of the remote machine) tells me that the server is running.
This sounds like a problem with a firewall. Can you telnet from your client machine to the Couchbase server on port 11210? From a command prompt, type telnet 192.168.1.150 11210
If you see a blinking cursor, the test succeeded and the firewall is likely not a problem. You may need to install a telnet client if it isn't already available. Windows Telnet installation: http://www.wikihow.com/Activate-Telnet-in-Windows-7
Related
I am trying to start H2 in server mode to connect an application from another computer. But no matter how hard I have tried, I have not succeeded.
I have seen the documentation and to start the server from the command line is executed:
java -cp h2-2.1.214.jar org.h2.tools.Server -tcpAllowOthers
output:
TCP server running at tcp://127.0.1.1:9092 (others can connect)
PG server running at pg://127.0.1.1:5435 (only local connections)
Web Console server running at https://127.0.1.1:8082 (others can connect)
now from the other pc, as I understand I must execute the connection in the following way:
jdbc:h2:tcp://[server][:port]/[path]/[databaseName]
then it should be:
jdbc:h2:tcp://127.0.1.1:9092/home/mateo/database
But I have read that 127.0.1.1 only works locally. I have also noticed that when I open H2 Console in the examples I have seen, the machine's ip appears, that is to say: 192.168.X.
What am I doing wrong?
(Update)
I am currently using Linux.
I have launched the server from Windows and managed to connect it from Linux successfully following the above steps. But, I still don't understand why it doesn't work in Linux, in Windows it loads the server with the IP address of the machine. It makes me think that I have to do some additional configuration for Linux.
server running
You need to replace local IP address in your JDBC URL with real non-local IP address of your server (jdbc:h2:tcp://127.0.1.1:9092/*** -> jdbc:h2:tcp://192.168.1.4:9092/***, for example). H2 listens all network interfaces of the host, it doesn't matter which address was reported in “runnig at …” message.
You also may need to protect ports 8082 and 9092 from connections from untrusted systems if you have them in your internal network and from connections from external network (make sure your router or whatever you have doesn't redirect connections to the host with database server).
I have a simple java written client and server chat application(with sockets). When running on the same network/computer it works fine. However when i try to run the client from a different network it doesn't connect. I tried using the public IP address of the server to connect the client to the server but without luck. How would I be able to connect to the server app from a different network? any help would be appreciated.
It sounds like you have more of a firewall issue than a problem with the application. Instead of trying to connect with the Java client, first try connecting with Telnet to the server from the same computer, then from the other computer. The first effort will show you what to expect when it works. For instance, if your server is running on port 999, use telnet server.example.com 999.
If the machines are Linux boxes, use iptables -L to see whether there is a block on the port you are trying to access.
If you're still having problems reaching the server, run tcpdump -i tcp:999 on the server host to see what traffic is making it to your server socket, then run the telnet commands again. You should see the tcp connection established when connecting from the local machine, maybe or maybe not when connecting from other machines. If you don't see it while connecting from other machines, run tcpdump there too to make sure the client is definitely sending the traffic to the server.
After you are sure that the server can receive traffic and that your client is sending the traffic, there are no mysteries about what is actually going on and you should find your problem.
It worked after I did port forwarding on router. Most of the ISP provided modem/routers wont let you manipulate ports so had to buy my own modem/router, forwarded the port and worked like a charm. Information on what port forwarding is can be found here : http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/
Ok, long story short. I have a local mysql server setup atm via wamp. I have it set to online. When I run my program via eclipse, and JDBC set to localhot, it works just fine, but if I set it to use my external IP, it won't connect. I have checked the ports, and scanned them as well, they come back as mysql server listening on port 3306. I think I ran into a problem like this several years ago, something about it being a loopback issue, how can I get around this? At the very least, how can I be sure that the db is public and running ok if I can't force my local system to connect with the external IP?
Try to do telnet on your public server ip port.
telnet yourpublicserverip sqlport
If it succeeds then your ip-port combination is available from outside. If it does not then most likely it will be a firewall issue and you may have to open your firewall to allow incoming connections on your sqlport.
I'm testing a client-server based Java application where a specific scenario involves having both the client and server running on the same host (i.e., the client connects to the server running on localhost). This seems to work fine except for when I test this scenario on a virtual machine (running 32bit Windows 7) using VirtualBox.
Note: Everything henceforth is running inside the virtual machine. I start the server and try to connect to it using the client but the connection times out. Surprisingly, I tried connecting to the server using putty and the connection behaved as expected. Both the Java client and putty tried to connect to localhost - the client failed but putty succeeded.
Does anyone have a possible explanation for why this might be happening?
Note: This is not a duplicate of Addressing localhost from a virtualbox virtual machine
How do you connect to the localhost? By connecting to the hostname "localhost"? You could try connecting to the InetAddress returned by getLocalHost()
I'm testing Java socket read/write basic example from Oracle.com
It can read/write if I run both server and client in the same machine.
But it doesn't work when it is to be read from other PC.
This is how they are connected via the same hub.
Internet->local network->hub->PC1 and PC2
PC1 is a server, running KnockKnockServer.java.
PC2 is a client, running KnockKnockClient.java.
Everything is same as default KnockKnockClient.java, but this:
kkSocket = new Socket("PC1", 18090);
But I got "Couldn't get I/O for the connection to: PC1" error.
I opened same port in Kaspersky program in PC1 and firewall in PC2.
Even if I turned off Kaspersky and firewall in PC1, it shows the same error.
Any ideas?
Thanks,
Try using an IP address instead of the remote hostname:
kkSocket = new Socket("192.168.0.1", 18090);
Windows networks typically use WINS for hostname resolution, rather than DNS - most home networks don't even have a DNS server. That allows Windows itself to find remote services (e.g. shares) by name, but most applications still require a proper DNS infrastructure for that to work.
Alternatively, you might want to edit the hosts file to associate the IP addresses of any hosts on your network with their names.