Android Question AsyncStreamsObject CRC Error Problem

quotidianvoid

Member
Licensed User
Longtime User
I have been working on a program that uses AsyncStreamsObject to send a file. It was working flawlessly but now all of a sudden a get an error every time I try to connect. Basically, my program creates a server/client Bluetooth connection and then the server will immediately attempt to send a file to the client. As soon as the devices successfully connect, I get the following errors:

From the server:
astream_Error: java.io.IOException: Software caused connection abort

From the client:
astream_Error: java.lang.Exception: CRC value does not match

The server error seems to be the standard error that gets thrown any time a BT connected device terminates the connection, so that is probably a red herring. I've been trying to investigate the client error that gets thrown regarding CRC validation.

As I said, up until this evening, this was working flawlessly. However, now, this error occurs every time I attempt to use one particular device as a host. The code I'm using is fairly simple:

B4X:
Sub Serial_Connected (Success As Boolean)
    ProgressDialogHide
    Log("connected: " & Success)
    If Success = False Then
        Log(LastException.Message)
        ToastMessageShow("Error connecting: " & LastException.Message, True)
    Else
        Notification1.Light = False
        Notification1.OnGoingEvent = True
        Notification1.Sound = False
        Notification1.Vibrate = False
        Notification1.Icon = "notification_present"
        Notification1.SetInfo("Bluetooth Connected", "Communicating over Bluetooth", "")
        Notification1.Notify(1)
        If ysdb.AStream.getIsConnected = False Then
            ysdb.AStream.start(yserial.InputStream, yserial.OutputStream)
        End If
    End If
   
    If bluetoothMode = BluetoothModes.Host Then
        ProgressDialogShow("Sending game file to client...")
        ysdb.AStream.WriteFile("file", File.DirInternal, "file.db")
    Else
        ProgressDialogShow("Waiting for file from host...")
    End If
End Sub

Everything else should be handled by the AsyncStreamsObject class. I have not made any changes to that file other than added a few additional lines for debugging purposes. I never get into Sub astream_NewData at all, the error gets called first.

I'm not even sure where to continue troubleshooting efforts, since everything is really contained within subroutines that I did not write, and have no insight into how to troubleshoot.

I appreciate any help you can provide. Let me know if I need to provide any additional information.
 
Top