connect to another computer in adhoc network with RMI - java

I have created a simple program , that two computers connect together. I have tested on same computer, no problem.
but When I create ad-hoc network (in Windows 8 for server and 7 for client).
One computer is a server, it run successfully
but in client i received this error :
exception in thread main java.rmi. connectioexception : exception creating connecting to java.net.socketexceptionn: network is unreachable connect
please help me :)

The network condition needs to be the same when you execute the client as it was when the server was started: specifically, the server must still have the same IP address, which must still be reachable from the client. RMI does not work with dynamic networks.

Related

not able to send messages with Multicastsocket over my local network

I am using the example server and client from this website. I have the client on my laptop and the server on my other laptop.
When I run them the server doesn't receive anything. When I run the server and client on the same laptop (doesn't matter which one) the server is able to receive messages. What might be the problem here?
One laptop has W7 and the other W10
I suggest you test multicast connectivity between your two machines using an existing program (without programming anything in Java). Are they in the same subnet?
I haven't used multicast in the last 10 years, but a quick search yields many results.

How to discover computers in this setup?

I have 3 computers, on the same local network. Computer #1 is a TCP server and computers #2 and #3 are TCP Clients.
When the server starts I am trying to find the IP Addresses of all available clients automatically, so I don't need to enter the IP addresses manually.
I have limited networking experience, can someone please list the ways to do the above?
There are at least 2 ways:
Send a UDP Broadcast message to every computer on the network from server and clients will reply back their IP. This seems not ideal.
Somehow (not sure how) the server set's up a hostname, e.g. "http://localhost//myapp" and clients check every few seconds if the hostname is up and then connect to server. This seems to be implemented in Java RMI.
I am trying to archive my goal using the Java API if possible and avoid writing much code.

ZeroMQ (0MQ), how to connect the client to a remote server?

I've implemented a simple ZeroMQ (0MQ) server and client. It works well when I use them on a machine (local). But when I run the client on one another machine, it doesn't work (it cannot connect to the remote server). I've checked my firewall and it's inactive (in Ubuntu 14.04).
My server code written in java is:
ZMQ.Socket responder = context.socket(ZMQ.REP);
responder.bind("tcp://*:5555");
and the client code:
requester.connect("tcp://ipaddress:5555");
in which "ipaddress" is the IP address of my server.
I've tried also different port numbers.
Please, explain what is the problem and what do you suggest to solve the problem??
Thanks in advance

Connecting to remote virtual machine using sockets

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!

Connecting to broadcast IP address

I am currently working on simple java program that should be able to seek out computer in a local network that runs my second java application, all using UDP networking. One of those apps opens DatagramSocket and starts a thread that processes all of the inputs. The other application connects to broadcast address of current LAN network (e.g. 192.16.0.255), sends a packet and receives the response. I'm not very familiar with the way this works but here is what I'm wondering:
If I launch two of those responding applications each on different computer of the same network and run client application on other computer, which of those will it connect to?
I thought it would connect and send packet to both but it connected just to one of them and sometimes not the same one.
Could you please explain this matter to me? I would appreciate it.
If I launch two of those responding applications each on different computer of the same network and run client application on other computer, which of those will it connect to?
Neither, UDP is a connectionless protocol.
I thought it would connect and send packet to both but it connected just to one of them and sometimes not the same one.
UDP is a lossy protocol, sometimes the data will go to both, one or neither. Your router could be setup to try to direct the broadcast traffic, but usually it will attempt to send all packets to all listeners.
BTW: All the listeners must be on the 192.168.0.255 C class subnet. A host with an IP address of 192.168.1.1 may not see this packet.

Categories

Resources