mortgagedeveloper
Programmer
I can only receive small files < 20kb. Anything over that will stop about 1k bytes from being completely delivered. The code below shows the loop that should be receiving. The Receive method hangs without Blocking and throws an exception with Blocking on. nothing I have tried will accept the entire file transfer, any suggestions?
Thanks in advance.
While totalReceived < m_iFileLen
'clear out the buffer
Array.Clear(buffer, 0, buffer.Length)
'check if any errors occurred, timeout in 5 seconds
If Not skt.Poll(5000, SelectMode.SelectError) Then
Try
'receive next part of data being sent into the buffer
bytesReceived = skt.Receive(buffer, buffer.Length, SocketFlags.Partial)
Catch ex As SocketException
Exit While
End Try
totalReceived += bytesReceived
'write the bytes to the end of the new file in the correct folder
bw.Seek(0, SeekOrigin.Current)
bw.Write(buffer, 0, bytesReceived)
Else
Exit While
End If
End While
Thanks in advance.
While totalReceived < m_iFileLen
'clear out the buffer
Array.Clear(buffer, 0, buffer.Length)
'check if any errors occurred, timeout in 5 seconds
If Not skt.Poll(5000, SelectMode.SelectError) Then
Try
'receive next part of data being sent into the buffer
bytesReceived = skt.Receive(buffer, buffer.Length, SocketFlags.Partial)
Catch ex As SocketException
Exit While
End Try
totalReceived += bytesReceived
'write the bytes to the end of the new file in the correct folder
bw.Seek(0, SeekOrigin.Current)
bw.Write(buffer, 0, bytesReceived)
Else
Exit While
End If
End While