1

I am writing a music app for android with xamarin that connects to spotify.

My problem is this - I have updated a copy of the libspotify-sharp project to work with the latest libspotify which works fine when debugging but if I try to run the app without connecting to the debugger (i.e if I deploy the app to a device and then run it like any other app on the device or if I use ctrl-f5 to "run without debugging") I cannot get libspotify to connect to the net and I get this weird message in the logcat: "[ap:1694] AP Socket Error: Software caused connection abort (103)".

Any thoughts as to what this could be would be really appreciated. Maybe there is some android firewall that is bypassed when debugging?

Regards, Mick

Below is a copy of the logcat:

07-21 14:07:41.680: D/Libspotify message(8036): 06:07:41.682 I [network.cpp:438] Connecting to 194.132.162.18:4070
07-21 14:07:42.170: D/dalvikvm(659): GC_EXPLICIT freed 200K, 10% free 6675K/7367K, paused 9ms+2ms
07-21 14:07:42.310: D/Libspotify message(8036): 06:07:42.316 I [ap:1226] Connected to AP: 194.132.162.18:4070
07-21 14:07:43.460: V/UPNPHelper(659): Thread-84192.168.240.116:58722:NONE
07-21 14:07:43.510: D/Libspotify message(8036): 06:07:43.524 E [ap:1694] AP Socket Error: Software caused connection abort (103)
07-21 14:07:43.510: D/Libspotify message(8036): 06:07:43.526 E [ap:3915] Connection error: 112
07-21 14:07:43.510: D/Libspotify message(8036): 06:07:43.527 I [ap:1752] Connecting to AP ap.spotify.com:443
07-21 14:07:43.510: D/Libspotify message(8036): 06:07:43.529 I [network.cpp:438] Connecting to 194.132.162.244:443
07-21 14:07:44.130: D/Libspotify message(8036): 06:07:44.145 I [ap:1226] Connected to AP: 194.132.162.244:443
07-21 14:07:45.370: D/Libspotify message(8036): 06:07:45.373 E [ap:1694] AP Socket Error: Software caused connection abort (103)
07-21 14:07:45.370: D/Libspotify message(8036): 06:07:45.375 E [ap:3915] Connection error: 112
07-21 14:07:45.370: D/Libspotify message(8036): 06:07:45.377 I [ap:1752] Connecting to AP ap.spotify.com:80
07-21 14:07:45.370: D/Libspotify message(8036): 06:07:45.379 I [network.cpp:438] Connecting to 194.132.162.244:80
07-21 14:07:45.980: D/Libspotify message(8036): 06:07:45.985 I [ap:1226] Connected to AP: 194.132.162.244:80
07-21 14:07:47.210: D/Libspotify message(8036): 06:07:47.216 E [ap:1694] AP Socket Error: Software caused connection abort (103)
07-21 14:07:47.210: D/Libspotify message(8036): 06:07:47.218 E [ap:3915] Connection error: 112
07-21 14:07:47.210: D/Libspotify message(8036): 06:07:47.219 I [ap:1752] Connecting to AP ap.spotify.com:4070
07-21 14:07:47.210: D/Libspotify message(8036): 06:07:47.224 I [network.cpp:438] Connecting to 194.132.162.18:4070
07-21 14:07:47.830: D/Libspotify message(8036): 06:07:47.838 I [ap:1226] Connected to AP: 194.132.162.18:4070
07-21 14:07:49.060: D/Libspotify message(8036): 06:07:49.082 E [ap:1694] AP Socket Error: Software caused connection abort (103)
07-21 14:07:49.060: D/Libspotify message(8036): 06:07:49.085 E [ap:3915] Connection error: 112
07-21 14:07:49.060: D/Libspotify message(8036): 06:07:49.089 I [ap:1752] Connecting to AP ap.spotify.com:443
07-21 14:07:49.060: D/Libspotify message(8036): 06:07:49.092 I [network.cpp:438] Connecting to 194.68.28.245:443
07-21 14:07:50.090: D/dalvikvm(31440): GC_CONCURRENT freed 438K, 8% free 7486K/8071K, paused 4ms+2ms
07-21 14:07:50.150: D/Finsky(31440): [1] 5.onFinished: Installation state replication succeeded.
07-21 14:07:52.420: D/Libspotify message(8036): 06:07:52.433 I [ap:1226] Connected to AP: 194.68.28.245:443
07-21 14:07:53.040: D/Libspotify message(8036): 06:07:53.046 E [ap:1694] AP Socket Error: Software caused connection abort (103)
07-21 14:07:53.040: D/Libspotify message(8036): 06:07:53.048 E [ap:3915] Connection error: 112
07-21 14:07:53.040: D/Libspotify message(8036): 06:07:53.049 I [ap:1752] Connecting to AP ap.spotify.com:80
07-21 14:07:53.040: D/Libspotify message(8036): 06:07:53.051 I [network.cpp:438] Connecting to 194.132.162.18:80
07-21 14:07:53.670: D/Libspotify message(8036): 06:07:53.662 I [ap:1226] Connected to AP: 194.132.162.18:80
07-21 14:07:54.880: D/Libspotify message(8036): 06:07:54.890 E [ap:1694] AP Socket Error: Software caused connection abort (103)

Fixed it! It was due to an incorrectly marshalled function (update to libspotify that I missed). The offending line was:

[DllImport ("libspotify.so")] internal static extern sp_error sp_session_login(IntPtr sessionPtr, string username, string password);

instead of:

[DllImport ("libspotify.so")] internal static extern sp_error sp_session_login(IntPtr sessionPtr, string username, string password, bool x, string y);

I still don't understand why it was consistently working when the debugger was connected and consistently not working when the debugger was not connected. Does the debugger do a memset to 0 on everything before starting a process or something like that?

Mick
  • 11
  • 2

0 Answers0