I have a problem that I think might be a java related one.
I have a java application I need to emulate multiple hosts.
The server/client work fine between "normal" computers.
When I use the emulator, I get connection refused when client tries to connect to a server in the emulator, same thing if I try telnet.
If I turn it around, the client cannot connect to the external server, but if I telnet from the external server, I get a connection.
This makes me think it is a java related problem.
Anybody gone through this problem before? This is for research purposes, so turning off java security only for this situation is no problem.
Thanks!
When you say emulator, I think you are talking about a virtual machine. Connecting from the real world into a virtual machine is not something that works automatically. The virtual machine can initiate connections out because the virtualization software handles that. Going the other way - what machine name do you use. How you configure your physical machine to routce packets to the ip address of your virtual machine (which your virtualization software made up). You may need a proxy on your physical machine to route the packets into the virtual one.
Related
Heyy guys. I'm writing a chat application in java, works pretty well. But can i somehow host my Server file or the Serversocket on the web? I want to make it so my friends from other pcs can use the client and connect to the server file which is hosted on the web. Is that possible? Can i host the File/socket online?
When you run a java application that opens a ServerSocket, it opens a port on your local machine and starts listening for incoming connections. What you do with those connections is up to the implementation of the java code that you write.
The "web" is much less foreign than you are making it out to be. Your own computer can be on the web that you're talking about and people can connect to your chat service. Or you can choose to host it on something like an AWS server.
The following approach is assuming you are behind a pretty standard NAT config.
Once you run your java application, you need to make sure other computers can see you, either inside your LAN or outside on the internet. You want to start testing from as close to your computer as possible, then start expanding outward.
First you need to make sure that your computer's firewall is actually allowing connections on the port that your java application is listening on.
Opening ports in the Windows Firewall
Setting up and opening ports in Linux
Now computers on your LAN will be able to connect to your java program. Now you need to go one layer out, and port forward your router. This is much less standard so I can't help you too much, but Google can.
At this point, anyone on this internet, knowing your external ip and what port your java application is listening, can connect to your service.
If you chose to host this on an third party hosting service, you'll need to go through similar steps, but there may be slight differences that you can either ask about, or again Google is a great resource.
I'm currently making a Java application that detects when smartphones connect to our home network. I'm able to get the IP addresses of all of the "remembered" devices on the network, ping the devices currently active on the network like desktops and laptops, but when I try to ping smartphones (either from command line or from the Java application using the InetAddress's isReachable() method) the requests time out.
Is this a problem with a security setting on our router? Do the phones (iPhones) themselves have security that prevents this? Is there any other Java code I can use to detect when these smartphones are or aren't active on the network? I haven't been able to find a particularly helpful answer so far in previous questions.
Thank you for reviewing my question!
It might be a good idea to inspect your network with Wireshark, or with an other similar software to see what is going on behind the scenses on your neteork. If you use linux, you may want to try the unix command arp-scan, which does network discovery for you.
I made a game with sockets that works fine on my machine, and now I would like to run the server on a host so that anyone can join in at any time.
All I'm finding are services for web applications, mine is just a swing application that can run by itself.
What kind of server can I use (instead of my own machine)? Would I need to change the code or is it possible to just find a host that runs my server application as is?
Also, note that for now I kept it simple, there is no data storage.
Take a look at Amazon EC2 cloud. Essentially what you're looking to do is acquire a public IP address (an be done from the Amazon EC2 admin console). You'll be installing java and then opening a port in your security settings to allow traffic to whatever port your game server is running on.
EC2 is free for low volumes of usage for the first year (new accounts only) and I've had fairly good luck with them in terms of downtime and affordability.
I am trying to connect to a virtual machine using sockets in Java. I have my client and server applications working with no issues on localhost. When I run the Server code and try to connect from a separate machine with the IP address and port number, my client connection times out.
Here is a link to my virtual machine network settings page https://wiki.redbrick.dcu.ie/mw/RBVM_Networking
Do I need to specify any particular parameters in Java to make my server accept connections? Is this an issue I have to take up with the VM network admins?
Any suggestions would be appreciated !
p.s I am running ubuntu server and can access phpmyadmin remotely with no problems.
Edit
I have run nmap and the port I am using for the server side application shows up as open.
My provider was blocking all but a select few ports, got a list of open ones and now it works. derp!
I'm running a Java application on my PC which involves migration of virtual machines running on my physical machine.
How can I connect to other physical machines on my network so that I can
1. Get info eg virtual machines running on them, emulator used etc. without the application being run on the client machine.
2. The network discovery must be automatic i.e. as soon as any PC is connected to the network, my machine should come up with all possible details of the PC.
3. I don't intend pinging all the computers on the network. I don't want any application run on the client machine. My machine should do the network discovery and info gathering by itself.
Could someone pls help me?
Thanks.
For 2 you should consider using Zeroconf as Apple do. For Java choose http://jmdns.sourceforge.net/
I've figured out a way to do the first part. This is how its done- 1. Open a connection to the qemu hypervisor on the destination physical machine through ssh. 2. use the same connect variable and Libvirt's functions to get the details about the other virtual machines running on the physical machine.