Frame of 1024 bytes for HTTPWEBREQUEST  
Author Message
Reno





PostPosted: .NET Framework Networking and Communication, Frame of 1024 bytes for HTTPWEBREQUEST Top

Hello !
I develop a program which upload a file (max 10Mo) to a server with POST METHOD.
For little files, there is no problem. But for files of 6Mo and more, the upload don't finish. I think that I upload data too quickly.
With Ethereal, I saw my data. There is a frame of 1452 bytes, after a frame of 96 bytes (or diffrent size), another of 1452 etc...
Another software (perhaps writted in C/C++) upload the data with frames of 1024 bytes. And it works perfectly.

How can I change the data buffer of TCP in .NET 2 Can I make frame of 1024 bytes
I can change the MTU in regedit, but I don't think that it's the solution.
I tried to change the length of "content" of my stream "rs" but no change.

I post a little part of my program :

Private request As HttpWebRequest

Dim content As Byte() = New Byte(1024) {}
Dim dataRead As Integer

Dim fs As Stream = getStream(Me.data)

Using rs As Stream = Me.request.GetRequestStream
While True
dataRead = fs.Read(content, 0, content.length)
If dataRead = 0 Then
Exit While
End If
rs.Write(content, 0, dataRead)
dataReads += dataRead
RaiseEvent PercentDone(dataReads, Me.data.Length)
End While
fs.Flush()
fs.Close()
End Using

Sorry for my poor english.
Thank you for reading.


.NET Development17