I am making an app that uses socket programming. Client side is programmed using android and server side using Java. The IP address of the server may change and the IP address has to be kept secure and private.
I do not want the users to install the app again and again when the IP of server changes.
You can use domain for your server . your domain is static and not change dynamically.
for example your domain is : yoursystem.com
now your server ip is : xxx.xxx.xxx.xxx
and tomarow your ip change to yyy.yyy.yyy.yyy
but your domain address is static and user can conect to your domain.
if your privacy is important you can improve your privacy by set token for your user and ...
Related
I have a node.js server running on my local system which interacts with postgresql in the same system to fetch and save data. I want to access node.js server from my android app to save and fetch data from postresql. The problem is my app is not able to connect to localhost. As localhost for my phone is different from my local system and if I am providing my system's IP address then also its refusing the connection.
I made server listen to hostname '0.0.0.0'. Initially I was not providing any hostname as argument in server.listen i.e it was like
server.listen('portnumber') which I changed to
server.listen('portnumber', '0.0.0.0');
if you are using android emulator and trying to access the the host machine's
local host use IP address : 10.0.2.2
for genymotion use IP address: 10.0.2.3
this should allow you to access the host machine's local host, but you will have to change this IP address to local IP address when running app on a device and connected to same network, to access from other network you need to open port(port forwarding I guess) in your router and talk ask your ISP to do the same.
here's a link to similar question : here
I am developing an Android SIP client. I'd like to test it against OfficeSip server. So I have set up the officeSip server locally and I can connect to it via officeSIP messenger (the client).
The messenger requires this data to login:
List item
addr: username#server_domain
username: username
password: password
protocol: protocol
server address: server address
However, when trying to do the same in Android, its SipProfile.Builder has a bit different parameters. Of note are the following:
public SipProfile.Builder (String username, String serverDomain)
public SipProfile.Builder setOutboundProxy (String outboundProxy)
There doesn't seem to be a server address available.
I have tried the following for serverDomain parameter:
user#server_domain/server_ip
server_domain/server_ip
server_domain#server_ip
many other combinations
However, I'm either getting connection error (when # is used) or registration failed event (when / is used with server IP after the /). Error codes are -4 (When some error occurs on the device, possibly due to a bug) first, immediately followed by -9 (The client is in a transaction and cannot initiate a new one)
How can I connect to OfficeSIP using Android SIP client?
Edit:
I managed to establish communication with CSipSimpleClient which uses a custom SIP stack. It only required server name (equal to server's domain), username and password.
I'm not sure.. but '#' and '/' are not allowed and SipProfile.Builder will make a URI, e.g. "username#serverDomain(or ip)", with username and serverDomain parameters.
Just try to set like this.. ("user1", "test.com"), ("user1", "1.1.1.1").
API description says "the SIP server domain; if the network address is different from the domain, use setOutboundProxy(String) to set server address" about serverDomain.
Turns out, Android SIP stack is quite immature and finnicky.
Ultimately I was able to connect by specifying both server hostname and server proxy.
Also, if server domain differs from computer name server is running on, you WILL have issues connecting. Domain must match either IP address or computer name, but they must match in order to connect via Android SIP client.
I have successfully connected to OfficeSIP with the android SIP API.
Download the SipDemo here
In WalkieTalkieActivity.java I modified the code to be the following:
SipProfile.Builder builder = new SipProfile.Builder("test", "officesip.local");
builder.setPassword("test");
builder.setOutboundProxy("192.168.10.191");
builder.setAutoRegistration(true);
me = builder.build();
In OfficeSIP test is the user with a password also test. The outbound proxy is the IP of the computer or server hosting OfficeSIP and officesip.local is the SIP domain name, which can be found in OfficeSIP under ther settings tab.
To test this I made a second account on OfficeSIP and logged into that account using Sipdroid. From there I called the SipDemo app running on a second phone and it worked.
I am working on an app where ,i am able to send an image only one way,from client to groupowner.How can i send it in both ways?
I had done bi-directional data transfer in my project. In Wifi Direct group owner Ip is decided by OS itself which is known to both devices i.e Server as well as client. Client know the IP of server on which it has to send data, But server don't know the client IP.
For that you have to send client IP address to server and store that address in sharedPrefrences. So you should initiate transfer silently when connection made so that server store the client IP, for next transfer.
Socket client = serverSocket.accept();
String WiFiClientIp = client.getInetAddress().getHostAddress();
you can made a check while transfer i.e if IP don't match server Ip then send data to client IP.
For testing purpose when you send file from client to server, in AsyncTask doinbackground method you can get the IP address of client which is also decide by OS itself. Put that IP statically then you will be able to send file on client also.
I will share my code on github soon. I hope this info will help you.
Working Bi-Directional Data Transfer APK File-> https://play.google.com/store/apps/details?id=anuj.wifidirect&hl=en
(192.168.0.103) this is my private ip address. I want to convert my private address to public. I am running apache-tomcat in my machine to provide service for my android application. Please help me out what i need to do?
I take it that you mean, 'how do I access an internal machine on my subnet externally'.
Determine the public IP address of the apache server by visiting a site that will show the public IP address (such as www.whatismyip.com).
In any firewalls between external and your apache server, set up port forwarding to the apache server. This will require you to map the inbound connections to your internal server.
On the local firewall on the apache server, make sure that inbound connections to the apache server are enabled.
Connect from your android device to your apache server using the public IP address from 1 and the port set up during port forwarding in 2.
Note: -
Be very careful about exposing internal devices to the public internet and allowing access into your subnet. Make sure that you server is secured correctly. Consider putting the server in a DMZ.
Unless you have a static IP address, the public address is likely to change.
I am a pure Android developer and don't know anything about Sybase Unwired Platform and Relay Server. I have a working SUP based project('m not one who develop it). I need to integrate Relay server in between SUP and Mobile. The Relay Server is installed and configured to SUP OUTBOUND ENABLER. Relay server port is 80 on SUP Server. But I don't know how to make data transaction through it and show data in android device?
It should be as easy as changing the ip of the SUP server to the ip address of the relay server, changing the port from the current port number to port 80, setting the messaging farm id and setting the url suffix. When configuring the relay server a backend farm would have been defined with a farm id. This is the id that you would need to enter here. Default relay server url suffix is "ias_relay_server/client/rs_client.dll" for Windows based relay server.
These are the properties for the connectionProperties.
You will also need to change the properties for the synchronisation profile. Here you will have to set ip address, port and stream params. Where stream params look something like "url_suffix=/ias_relay_server/client/rs_client.dll/"