androidandroid-wifi3gandroid-internet3g-network

Android Client App with 3G and WIFI Network


I'm developing an application that need an internet permission all the time. When there is a WIFI connection the application can connect to my server (if they're in the same network) actually I have 2 question..

1) Lets say that the server is connected to network A and the client is connected to Network B (on WIFI) why it doesn't show me on the server side the message that I send? I made a simple project that when the client is connecting to the server it send "hello" to the server, the server read it and tell me the address of the client and the message (print to the console), it works fine when both server and client are at the same Network.. but when they're in different networks it doesn't work.

2) How a 3G application is working? how can I connect the client who uses a 3G network to my server?


Solution

  • When you are on the same network then you give the the ip the ROUTER gave to your pc and phone (assuming that what your using) and it looks something like 192.168.0.101\2 (its your router Default address + 1 each time a device connects to the router) ...

    The problem is that when you want to connnect from an outside source you must give the ip of your real address given by your ISP.

    go to command\terminal and type ipconfig and look for IPv4 ------ thats your real ip when looking from the "outside" world , now thats not all you also need to configure your router to port forwad the ports your using to the specific PC that is the server.

    How what and why : Port Forwarding

    hope this helps.