August 2, 2013

Python server is now working

Earlier, we have a problem in sending the data from the Android App to the Python server on Rpi. I wrote:

"On Rpi, the App shown that connection has been made with the server and data has been successfully sent, but none of those are indicated on the server that I ran"

Well, I was half correct and half wrong.

Based on this thread, the problem lies in the default configuration of Bluez where pnat plugin (a plugin file written in c for Nokia's Maemo platform) is enabled. The plugin effectively breaks any application that tries to run Rfcomm server. Running the App through Eclipse shows "connection reset by peer" error even though initially connection was made. So, the connection was initially made, but it is then terminated by the plugin right at the point where data is to be send.

To fix this, just disable pnat plugin.
1. Navigate to  "/etc/bluetooth/main.conf"
2. Edit the file with root "sudo nano main.conf"
3. Append the following "DisablePlugins = pnat" in the main.conf file.
4. Save and Exit - Press 'CTRL-X' and 'Enter'
5. Restart bluetooth by issuing "sudo invoke-rc.d bluetooth restart"



No comments:

Post a Comment

Write a reply