SOLVED - But I'm not sure how, I was redesgning the app so that I could put it up here for other leo owners to test and gave it one last go to take a screenshot of the error to show people what I was looking for and viola it starts working (I never changed the TCP code) sorry anyone who finds this who has the same issue but it just randomly started working!!
Hi fellow devs,
After a massive googling session I have not been able to find an answer to the following issue:
I am writing a TCP client/server app with my PC as the server and the client being my HD2.
I am writing the app in VB.net using the .net compact framework 3.5 and the windows mobile 6 sdk.
I just cannot get the following code on the client side to work over wifi:
Code:
Dim ParsedIPAddress As IPAddress = IPAddress.Parse("192.168.1.10")
Dim client As New TcpClient()
client.Connect(ParsedIPAddress, 7209)
I get the following exception:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Click to expand...
Click to collapse
If I connect the phone via active sync it will work and I can send and recieve data ok so it appears there is no issue with the code itself.
While connected via active sync - if I turn off the server side app I get the following exception:
No connection could be made because the target machine actively refused it
Click to expand...
Click to collapse
However the exception message remains as the original if I do the above but using wifi so it just is not able to establish a link at all (or not even trying) using wifi??
-----------------
I have tried:
1. Ensuring that windows firewall on the server is off and not getting in the way of anything
2. Ensured that my mobile has got an active wifi connection and can see the machine (wifi remote control apps such as GRemotePro work ok)
3. Turned off all other types of data connection (GPRS,3G) to make sure my mobile has only one route out
------------------
Is there anyone out there who has successfully got TCP to work with the .net compact framework and if so how???
Should I be using another class rather than TCPClient maybe the underlying Sockets class?
Any help would be greatly appreciated.
Cheers,
Prime.
P.S. I don't mind if people only have a solution in C# I'm happy to do any translation etc...
Socket class also fails
Ok so I've tried the socket class now as well and that fails in exactly the same way over wifi, ensured that I can ping my device and ping my pc from the device so clearly the underlying hardware is working just not for the TCPClient or Socket... Any ideas anyone?
Have you enabled port forwarding for the relevant port and IP address in your wireless router?
That's the only thing that springs to mind for me.
Thanks for the reply but...
Hey John,
Thanks for trying to help although unfortunately this does not bear any consquence in this particular situation, you only need to do port forwarding if Network Address Translation is going on between you and the end point. In this case the endpoint (IP + Port) is on the internal LAN with no address translation in between. It appears the the internal WIFI adapter is not being accessed correctly from the application i.e. this is an internal issue on the phone not an issue with the network in general as I can run the same code via active sync and it works also I can convert the project to a standard windows pc app and run the same code from a pc and it works. Oh and of course every other damn (this is really wierd) wifi app I've got works so something with the .net cf and wifi maybe??
Cheers,
Tony.
A development...
Ok so I have dug out my old Orbit II just to see if this was device related and low and behold it is ARGGGHHH!!! The app works just fine on the Orbit II over wifi.
Does anyone know of any policies, security or otherwise, that would stop the HD2 (leo) from being able to use wifi from the .net cf?
<<--delete-->>
Generic reasons for communication failures
Hi
This is a pretty generic problem, I'm afraid you can't give an exact idea of where is the problem so I can't give also an exact solution.
Usually a communication problem is due to one of this three
1) The server does not listen or does not receive
2) There is a problem with the network
3) The client does not make the call
Type 1 should be checked trying to connect to the server with a PC or a laptop. You should be able to make the client run in a PC.
Usually when a (web) server has a (web) tcp service stopped, when you try to connect to it it rejects the connection (this is what that of "the target machine refused it" sounds to me). Start then the (web) service on the server. Change (web) for your application.
My advice is that you should have something in the server side where you could run a wireshark sniffer. Then you would see all the traffic coming from the PDA and see if your client is sending packets.
Type 2 are the ones that can be checked with a ping. Maybe there is a firewall somewhere dropping the packets.
Type 3 may be due to several things
a wrong code (I don't know, there is a lot of time since I made programs)
you're trying to connect to a dns name that can't be resolved. Try with IP address.
You have a wrong network configuration. The server should be in the same network but client is not able to get the server's (or the router's) MAC with the ARP protocol. So it doesn't make the call.
I hope it helps.
Regards
How can I reverse tether my Android phones to my PC via Bluetooth? Is this even possible?
PC is running Windows 7 x64. Phone is an HTC HD2 running JellyBean AOSP from NAND. I know Wifi would be easiest, but this is a work PC and company policy is we are not allowed to run our own Wifi networks.
I managed to connect the HD2 to the PC via Bluetooth with a PAN network, it only worked when I turned on Internet Tethering on the phone. However, this makes the HD2 into the server and PC into the client so PC can use phone's internet connection. I need the reverse! I need HD2 to be the client, PC to be the server. I found a Bluetooth PAN client from the Play store, but it can't connect via PAN to the PC. I assume because the MS BT stack only has a PAN client and not server. Is there such a thing as a PAN server for PC? I've looked at Widcomm and Bluesoleil BT stacks, but neither specifically mentions having a PAN server.
I found this tutorial that sounds promising, using DUN instead of PAN:
http://bluedunapp.blogspot.com/2012/05/bluetooth-tethering-for-android-devices.html
It's for reverse tethering an Android device to another Android device. Looks like BlueVPN on the Android side will do what I want, be a DUN client. However, similar problem to PAN, I can't find a DUN server. It's apparently not built into the MS BT stack either.
Is it even possible to reverse tether an Android phone to PC over Bluetooth?
Only other idea I can think of is to use an intermediate device as a bridge. USB reverse tether a phone to PC, and use phone's bluetooth tethering abilities to tether my bluetooth phone to it. Really round-about way to go about it though.
not exactl but it works
hi i cant find out a way to connect through bluetooth but i found some apps which can connect your mobile to internet through usb connection
but it requires root access
1.ReverseTether.Trial in google play
2.just search for "reverse tethering galaxy y in google" and select first link from "galaxyyarchive,info" worked for me but dont know about other phones
sorry i cant post links right now
bye
GnatGoSplat said:
How can I reverse tether my Android phones to my PC via Bluetooth? Is this even possible?
PC is running Windows 7 x64. Phone is an HTC HD2 running JellyBean AOSP from NAND. I know Wifi would be easiest, but this is a work PC and company policy is we are not allowed to run our own Wifi networks.
I managed to connect the HD2 to the PC via Bluetooth with a PAN network, it only worked when I turned on Internet Tethering on the phone. However, this makes the HD2 into the server and PC into the client so PC can use phone's internet connection. I need the reverse! I need HD2 to be the client, PC to be the server. I found a Bluetooth PAN client from the Play store, but it can't connect via PAN to the PC. I assume because the MS BT stack only has a PAN client and not server. Is there such a thing as a PAN server for PC? I've looked at Widcomm and Bluesoleil BT stacks, but neither specifically mentions having a PAN server.
I found this tutorial that sounds promising, using DUN instead of PAN:
http://bluedunapp.blogspot.com/2012/05/bluetooth-tethering-for-android-devices.html
It's for reverse tethering an Android device to another Android device. Looks like BlueVPN on the Android side will do what I want, be a DUN client. However, similar problem to PAN, I can't find a DUN server. It's apparently not built into the MS BT stack either.
Is it even possible to reverse tether an Android phone to PC over Bluetooth?
Only other idea I can think of is to use an intermediate device as a bridge. USB reverse tether a phone to PC, and use phone's Bluetooth tethering abilities to tether my Bluetooth phone to it. Really round-about way to go about it though.
Click to expand...
Click to collapse
So far there isn't any app that does a reverse tether through Bluetooth. Only Wi-Fi @ usb tether are currently possible.
GnatGoSplat said:
Only other idea I can think of is to use an intermediate device as a bridge. USB reverse tether a phone to PC, and use phone's Bluetooth tethering abilities to tether my Bluetooth phone to it. Really round-about way to go about it though.
Click to expand...
Click to collapse
Brilliant idea mate for the time being :good: :highfive:
texasranger770 said:
Brilliant idea mate for the time being :good: :highfive:
Click to expand...
Click to collapse
Unfortunately, I couldn't get this to work. I tried using "Bluetooth PAN for Root Users" on the client phone and it wasn't able to see the Bluetooth connection on the phone which has a Bluetooth tethering checkbox. However, my PC with bluetooth dongle was able to make a PAN connection to that phone, so I guess it's something with the "Bluetooth PAN for Root Users" which isn't compatible.
There's a way to do that using USB Tunneling. An xda member has done this, and I'm using my PC's Internet connection on my HTC Desire with a USB cable. The download below will possibly work for any phone... I'm not taking any credits for this tool and app. This belongs to someone, and I downloaded it, but can't remember who made this. Anyone who knows, please correct me...
I've actually been using that tool for awhile. Its official post is here. http://forum.xda-developers.com/showthread.php?t=1371345
GnatGoSplat said:
Unfortunately, I couldn't get this to work. I tried using "Bluetooth PAN for Root Users" on the client phone and it wasn't able to see the Bluetooth connection on the phone which has a Bluetooth tethering checkbox. However, my PC with bluetooth dongle was able to make a PAN connection to that phone, so I guess it's something with the "Bluetooth PAN for Root Users" which isn't compatible.
Click to expand...
Click to collapse
Does the android phone BT stack even support the PAN client role? I guess it may not be there. Could you clarify??
I don't know, I'm going to guess not.
I used to setup Windows on a Broadcom/Widcom bluetooth stack/driver to do this Bluetooth Reverse Tethering for Android - no rooting or apps required. Phone needs to support Bluetooth network access feature - no rooting or apps required as this is a standard/implemented protocol - Samsung S3, Sony Xperia V, Nexus 5, Nexus 4 support it, etc. To check, a phone that supports "bluetooth tethering" would likely support the "bluetooth internet access" (which is "bluetooth reverse tethering") feature. So, as an easy check - on your Android, go to Settings > More… > Tethering & portable hotspot - Now look for a “Bluetooth Tethering” item - if it is available, there’s a good chance that your device is compatible - but if you can’t find it, your device is likely NOT compatible.
As a roughly remember - the steps are like:
1. You need to enable the "Network Access Point" profile in the configuration and you'll get a new "network device"
2. Then in the control panel, go to the connection list, then ctrl-click the new bt-network-device and your LAN ethernet network device - right click and choose "bridge" to bridge it with your LAN.
3. Try pair android phone (which has the bluetooth "internet access" feature) with pc then if all is well, you'll see the bluetooth settings button for your computer - "If this inner settings page has the “Internet Access” item and checkbox shown".
If you tried on the Broadcom stack and still need help - I might try make a blog post with detailed screenshots someday if i can get some free time...
Okay, now I have a new PC running Windows 8.1 which has built-in Broadcom bluetooth, and a different phone, Motorola Droid Mini XT1030. I've installed the most recent WIDCOMM stack.
I'm able to connect a new Bluetooth PAN network device, but there is no "bridge" option. There are for other devices like the PC's built-in Wifi, but not for the bluetooth.
Am I missing something?
I've also tried using USB Reverse Tethering using an old phone as a bridge, but that doesn't work either.
http://forum.xda-developers.com/showpost.php?p=53822503&postcount=1992
ykasidit said:
I used to setup Windows on a Broadcom/Widcom bluetooth stack/driver to do this Bluetooth Reverse Tethering for Android - no rooting or apps required. Phone needs to support Bluetooth network access feature - no rooting or apps required as this is a standard/implemented protocol - Samsung S3, Sony Xperia V, Nexus 5, Nexus 4 support it, etc. To check, a phone that supports "bluetooth tethering" would likely support the "bluetooth internet access" (which is "bluetooth reverse tethering") feature. So, as an easy check - on your Android, go to Settings > More… > Tethering & portable hotspot - Now look for a “Bluetooth Tethering” item - if it is available, there’s a good chance that your device is compatible - but if you can’t find it, your device is likely NOT compatible.
As a roughly remember - the steps are like:
1. You need to enable the "Network Access Point" profile in the configuration and you'll get a new "network device"
2. Then in the control panel, go to the connection list, then ctrl-click the new bt-network-device and your LAN ethernet network device - right click and choose "bridge" to bridge it with your LAN.
3. Try pair android phone (which has the bluetooth "internet access" feature) with pc then if all is well, you'll see the bluetooth settings button for your computer - "If this inner settings page has the “Internet Access” item and checkbox shown".
If you tried on the Broadcom stack and still need help - I might try make a blog post with detailed screenshots someday if i can get some free time...
Click to expand...
Click to collapse
Hi ykasidit,
could you please provide more detail explanation on how to enable the "Network Access Point" profile in the configuration to get this new "network device"?
Hi,
I have many devices that connect via bluetooth to my Nexus 4 (4.4.2) and when I enable bluetooth i have to wait until it connects (and i disconnect) or fails to connect to the last connected device - which takes too much time.
Is there a way to disable auto-connect when enabling bluetooth? I would simply like to select a device after ive enabled it.
I searched here and elsewhere but could not find a soln.
Thanks in advance.
HH
This issue is still ongoing.
My Phone is connecting to the HiFi when I turn on BT to receive a call with my headfset. It's really bothering. Bad Google nerds.
When you restart the phone and turn on BT, it is not auto connecting ... until you try to connect a device.
So I think the last conncetion attempt is stored somewhere temporaly and it is repeating on and on.
I can't believe that there is no fix for this bad issue available since years :-(
This sounds interesting about autoconnect.
But I am not a programmer :-(
Making Android BLE work — part 2
In my previous article I extensively discussed the topic of scanning. In this article we’ll look at connecting, disconnecting and…
medium.com
I am looking to simulate an additional WiFi device in a rooted android emulator (to simulate a device my company makes). So far I have found the linux kernel module, mac80211_hwsim, which seems like it would help me create virtual networks like this. I believe this is also the mechanism that the emulator uses to create its fake wifi network already.
If this is in fact the right way forward, once I create some more channels for that kernel module, I want to be able to connect to a program on my local computer after connected to this other WiFi network (similar to how 10.0.2.2 maps to the host computer). (the redir command looks helpful on the emulator for this)
Does this sound reasonable and does anyone have some tips going forward? It's been challenging to find information that is relevant to Android in this area.
I am looking to simulate an additional WiFi device in a rooted android emulator (to simulate a device my company makes). So far I have found the linux kernel module, mac80211_hwsim, which seems like it would help me create virtual networks like this. I believe this is also the mechanism that the emulator uses to create its fake wifi network already.
If this is in fact the right way forward, once I create some more channels for that kernel module, I want to be able to connect to a program on my local computer after connected to this other WiFi network (similar to how 10.0.2.2 maps to the host computer). (redir emulator command looks helpful)
Does this sound reasonable and does anyone have some tips going forward? It's been challenging to find information that is relevant to Android in this area.