I'm writing an Android app for home automation wherein the app connects to my home PC via sockets so that I can control various home appliances on the move. My question is how do I make my home dynamic IP static and accessible to other devices on the internet so that I can make this connection. Thanks! :)
Try a free dynamic DNS service such as No-IP. The basic idea is that you install an application on your server that keeps your IP address up-to-date on No-IP, so they can maintain a DNS record that points to your server. It'll give you a subdomain, not a second-level domain, but that should be Good Enough.
Related
I have java programs for my client and server, and they work fine within the same wifi network. But I need the clients to be able to connect to the server from the open internet. In questions like these
How to connect client and server with the help of ip address which are connected to internet through different wifi?
https://coderanch.com/t/667020/java/Socket-connections-networks
the solution is to manually reroute a port to the server from the router, making it open to connections from the outside. Is there a way to do this with just software on the server? I don't understand why manually dedicating ports is necessary since of course other applications on my computer (like games) that I install communicate with their servers back and forth without me having to manually go in and flip switches.
How can I achieve this with just software running on my server?
If there isn't another way, how do other applications communicate openly without manual router changes, and will opening up ports through my router result in security issues?
You would need to change the architecture of your application. Currently, your server is behind a firewall which blocks connections from the internet - you want this! If you allowed all traffic from the internet to connect indiscriminately to your server, it would be very vulnerable to attack.
Other applications install and communicate without port-forwarding because the developer provides a server on the internet to act as a proxy between clients. The client connects out to the internet which is generally not blocked on home networks. Internal connections going out are considered less harmful than connections coming in.
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.
Initially, ip-addresses from the ISP are always changing. I am working on an android app and I need to connect from outside my home to my internal network. I need a server connected to my modem/router and the server should save the public ip of my home network every time it changes.
Goal: make a communication between my android app and the modem/router.
My question is:
Do I have to program an app on the server side to do this job, or is there an app already available?
If none are available, could you please tell me the steps to create one, or any references to that end?
Thank you!
I think your best bet is to use a dynamic dns service. That will allow you to give your machine a string name, run the app they'll give you (or many routers support this built-in), and just reference the computer by name when you need it. See http://en.wikipedia.org/wiki/Dynamic_DNS
I recently developed an Android application with which the Android device can communicate with another Android device running the application.
The communication works over sockets, therefore I developed a server which i run on my computer.
Here is my problem:
The communication between the devices over the Server running on my PC works fine, as long as all devices as well as the PC are in the same LAN (connected over the same Router for example).
Now I want to get the server online, so that the Android devices can connect to the "online" server and communicate with each other over the server from anywhere.
I simply have no idea of how to get the server online and running. How can I do that?
The main issue is, that I know about Client/Server communication locally, but have no experience in the "online" sector.
It is more a network problem than a programming one. Your server open a socket and therefore is available to anyone able to reach that socket.
You have to do a redirection on your router. The problem is that your machine doesn't have a public IP, only your router has one. So when your router receive a packet on port 21 for example, it doesn't know what to do with it. You have to configure it to say "the port 21 has to redirected to the local IP XXX"
Also the public IP of your modem/router can change, depending on your ISP. If your have a fixed IP, it won't change, otherwise you will have to install a software like dyndns to have a domain name associated with your IP.
I have a basic web application written in Java, running on a tomcat on my localhost. Currently it's just a simple application with a single servlet to which I access from my browser.
I want to write a mobile android application which will be the client of my Java web application. I want the servlet to write to a DB and do some logic, but to access it from a mobile app.
Currently I don't have any domain registered.
How can I expose my Java web app so that in my development environment I would be able to access it via my mobile device? Meaning, currently it runs locally on my PC and I access from the browser (on localhost). I want to access it from a different device (mobile) - how can it be done in my home LAN?
Thanks.
If the web app is hosted on your local server, your mobile will need to be able to access the IP address (ie: 192.168.1.100) and port (ie: 8080) that is hosting the app.
There are several ways to allow your mobile to communicate to your desktop:
Direct connection via USB or Bluetooth.
Wireless connection on your LAN - if your mobile can connect
wirelessly to your home LAN, you should be able to access your web
app (your desktop's firewall may have to open up your web port)
External access. This requires opening up your home network to allow
access to your desktop's web port. Also your internet router would
have to be configured to allow access and likely do a NAT
translation. Note that in this scenario, anybody can access your web
app so be very careful. You would also need to use your external IP
address instead of your internal LAN address.
A domain is only required to allow the use of a name (http://www.example.com) instead of your IP address.
For testing, if your mobile device is on the same LAN as your server, just use the servers ip address on the LAN. Give the server a static ip address and your sorted.
For the next stage of testing, you'd need to expose your pc to access via the Internet. You'd usually do this by configuring your NAT settings on your home router. You should be able to google this.
Then your mobile device can use 3G and should talk to the server via your ISP ip address. This will hit your router and the NAT routing will forward it to your server machine on your LAN.
If you need any clarification, just ask !