Global Networking

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hello everyone,

I want to add a feature to my project Tracked! where u should be able to "control" your phone from your desktop.
Now I am able to connect to my device over a wifi connection and the connection is established. However, when I try to connect with my device over EDGE/3G, I cannot seem to connect with it.

These are my logs:

Port forward: Port 7890 done
Firewall: off

Logs when connected to pc with wifi:

** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Service (b4aserverservice) Start **
Server not connected. Calling board web service.
Http success. Waiting for server to connect...
Connected = true
Sending Task #6
6 done. Success=true, msg=File saved: /mnt/sdcard/6
Connected = false

On server:
C:\Users\Admin\Desktop\b4aserver>java -cp b4aserver.jar anywheresoftware.b4a.b4a
server.Server
B4A server is started. Checking URL: http://66.84.14.57/android/b4a_server.php,
server name=rootsoft
trying to connect to: 192.168.1.112:7890
Connected to: 192.168.1.112:7890
192.168.1.112:7890: stop message received.

Logs when trying to connect to pc without WiFi ( So normal mobile connection over EDGE)

** Activity (main) Pause, UserClosed = true **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Service (b4aserverservice) Start **
Server not connected. Calling board web service.
Http success. Waiting for server to connect...
** Activity (main) Pause, UserClosed = false **

On server: (when pressed a button.)

trying to connect to: 10.48.34.190:7890
Error occurred while working with ip: 10.48.34.190:7890
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at anywheresoftware.b4a.b4aserver.Communicator.run(Communicator.java:36)

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


logs.png

http://i1189.photobucket.com/albums/z428/xverhelstx/logs.png

So probably, I am able to send outgoing connections, but unable to receive them. Does anyone have an idea how I can accept them or what another thing could be that disables this, or another feature to control the phone?

Also: http://www.canyouseeme.org/ seems to have a connection refused when I try to connect with port 7890

Thank you,
XverhelstX
 
Last edited:

XverhelstX

Well-Known Member
Licensed User
Longtime User
1. How does this work then?
Ok, now I understand that it is a technique where information is automatically send, without the user requesting it.
but how would I use this with a web server AND how should this information then sent to the desktop server?
I cannot seem to find so much information on how it works, so could u please tell me if this is right?

Desktop input sents to web server where push technology is. Push Technology immediatly send the data to the phone(?)

2. So it's not possible to work with a server on the desktop then?

As I see that CrazyRemote Pro doesn't need it and could work on WiFi/3G/...

Thanks,
XverhelstX

EDIT: Also it's not related to my ISP as it now seems not blocked after removing some antivirus softwares.
Success: I can see your service on xxx.xxx.xxx.xx on port (7890)
Your ISP is not blocking port 7890
but I still cannot seem to connect.

EDIT2: So I basically understand more from Push Notification, altough, it still won't work for Tracked though?
As the device needs to connect to the web service, how would this work then with multiple users?

So according to this:

ere is the sequence of events that occurs when the application server sends a message:
The application server sends a message to C2DM servers. (My desktop client sends a message to C2DM servers)
Google enqueues and stores the message in case the device is inactive.
When the device is online, Google sends the message to the device.
On the device, the system broadcasts the message to the specified application via Intent broadcast with proper permissions, so that only the targeted application gets the message. This wakes the application up. The application does not need to be running beforehand to receive the message.
The application processes the message. If the application is doing non-trivial processing, you may want to grab a wake lock and do any processing in a Service.

That's what I still don't understand if multiple users use it, how would the C2DM know that it won't send it to another device.

http://code.google.com/intl/nl-NL/android/c2dm/
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use your desktop as a web server. Google it, you will find several tutorials. You will probably need a static IP for that.
Google C2DM service is not yet available for the public. I'm not familiar with its details. There are many ways that it can know how to send the message to the right phone. Similar to SMS messages.
 
Upvote 0

bluedude

Well-Known Member
Licensed User
Longtime User
That is the "old skool" way to do it. Services like Twitter nowadays use realtime push. There are a few HTML push services like Pusher an Beaconpush.

Polling is very "expensive" in terms of battery usage. Would be great to have push support but right now most if this is websockets. Not sure if webview supports that.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Is 10.48.34.190 the IP address of your Android device?

If so then your device has no real IP world address and is not accessible from the internet.

It's likely that your device's network provider uses NAT and provides an internal IP address for your device.

Different providers have different ways of assigning IP addresses - some will give you a real world IP address, many use NAT and assign a NAT'd single internal IP address to all devices connected on their network.

Three UK do both - they have two APN names "three.co.uk" and "3internet".
If you use three.co.uk your device gets a NAT'd internal IP address, and if you use 3internet you get a real world IP address.
three.co.uk is intended to be used by mobile phones etc and 3internet is intended to be used by 3G dongles hence the difference.

Martin.
 
Upvote 0
Top