Hi Ian, sorry i was very busy!
This is my VB6 code in a Winsock data arrival:
Winsock.GetData DatiRX(), vbByte, bytesTotal
If Stream = 0 Then
i = UBound(DatiApp)
If i = 0 Then i = -1
ReDim Preserve DatiApp(i + bytesTotal)
For j = 0 To bytesTotal - 1
DatiApp(j + i + 1) = DatiRX(j)
Next j
Progress = 0
BASS_SetConfig BASS_CONFIG_NET_BUFFER, Val(lblBufferRX)
CreateFileProcs
If UBound(DatiApp) < 4095 Then Exit Sub
Stream = BASS_StreamCreateFileUser(STREAMFILE_BUFFERPUSH, BASS_STREAM_BLOCK, VarPtr(Fileprocs), 0)
End if
If Stream <> 0 Then
If (BASS_StreamPutFileData(Stream, DatiApp(Progress), UBound(DatiApp) - Progress) = -1) Then
BASS_StreamFree Stream
Stream = 0
Exit Sub
End If
Else
BASS_StreamPutFileData(Stream, DatiRX(0), bytesTotal)
End if
and this is in a module:
Public Sub CreateFileProcs()
With g_Fileprocs
.close = getaddressof(AddressOf FILECLOSEPROC)
.length = getaddressof(AddressOf FILELENPROC)
.read = getaddressof(AddressOf FILEREADPROC)
.seek = 0
End With
End Sub
Public Function getaddressof(ByVal func As Long) As Long
getaddressof = func
End Function
Public Function FILECLOSEPROC(ByVal user As Long) As Long
FILECLOSEPROC = 0
End Function
Public Function FILELENPROC(ByVal user As Long) As Long
FILELENPROC = 0
End Function
Public Function FILEREADPROC(ByVal buffer As Long, ByVal length As Long, ByVal user As Long) As Long
If length > UBound(DatiApp) - Progress Then length = UBound(DatiApp) - Progress
CopyMemory ByVal buffer, DatiApp(Progress), length
Progress = Progress + length
FILEREADPROC = length
End Function
This work good with bass.dll 2.4.7.