I encountered a strange behavior when using the Socket.BeginSendFile method in a Xamarin Forms app on android.
When I run my app using the Visual Studio debugger (with an android phone connected over USB) and want to pass a large file (7 MB) over a TCP connection, only the first 2 MB of data are being sent. Transmission then stops.
The app functions as a TCP client. I checked with Wireshark and the TCP packets all look OK: The last 2 packets or a TCP ACK from my app (sending some data), followed by a TCP ACK from the server. The socket remains active.
When I run the app without the debugger (directly from a smartphone) the error doesn't seem to occur. The complete 7 MB of data is being transmitted.
I use Socket.BeginSendFile because that gives the highest throughput. When I do the exchange with 'normal' Socket.BeginSend calls (and my own file stream and reader code) the error never pops up, but throughput is bad. Transfer speed is about 40 times less than with Socket.BeginSendFile.
Is there anyone who can shed some light on this? The issue is probably in the Mono runtime since only System.Net.Sockets is being involved.