Search code examples
javanetworkingtcpudpinetaddress

Which ip address should I use to connect 2 computers in my home using datagram sockets in java?


I am trying to connect 2 computer in my home using DatagramSockets (or even Sockets) in java. What exactly should I do? Which IP Address should I use to connect them?


Solution

  • If your machine is using DHCP then it's not upto you to decide which ip address you will use. Your machine will be assigned some dynamic ip address. To see that use ifconfig on Linux box and ipconfig on win machine. Once you have their IP address you can use these to connect your machine. Chances are high that your machine has dynamic ip's.