[mono-vb] Mono Hangs on Using streamResponse As Stream = request.EndGetRequestStream(result)

Rolf Bjarne Kvinge rolflists at ya.com
Mon Jan 3 06:39:56 EST 2011


Hi,

 

I can see nothing obviously wrong with your code, however I'd need a
complete sample to try it out.

 

Thanks

Rolf

 

From: mono-vb-bounces at lists.ximian.com
[mailto:mono-vb-bounces at lists.ximian.com] On Behalf Of Easy_Rider9999
Sent: domingo, 02 de enero de 2011 14:17
To: mono-vb at lists.ximian.com
Subject: [mono-vb] Mono Hangs on Using streamResponse As Stream =
request.EndGetRequestStream(result)

 

 

This is the code:
<code>
 ''' <summary>
  ''' Submit data asynchronously
  ''' </summary>
  '''
  Private Sub ReadCallback(ByVal result As IAsyncResult)
    Const CodeLoc As String = ClassName & ".ReadCallBack"
    gStatus = CodeLoc & " Start"
    Dim state As RequestState = DirectCast(result.AsyncState, RequestState)
    Dim request As WebRequest = state.request

    ' End the Asynchronus request.
    gStatus = CodeLoc & " EndGetRequestStream"
    Using streamResponse As Stream = request.EndGetRequestStream(result)
      ' Submit content
      If state.content IsNot Nothing Then
        gStatus = CodeLoc & " streamResponse.Write"
        streamResponse.Write(state.content, 0, state.content.Length)
      Else
        gStatus = CodeLoc & " New FileStream uploadFilePath = " &
state.uploadFilePath
        Using fs As New FileStream(state.uploadFilePath, FileMode.Open,
FileAccess.Read)
          Dim content As Byte() = New Byte(4095) {}
          Dim bytesRead As Integer = 0
          Do
            gStatus = CodeLoc & " Read"
            bytesRead = fs.Read(content, 0, content.Length)
            streamResponse.Write(content, 0, bytesRead)

            'XXX: perform upload status callback
          Loop While bytesRead > 0
        End Using
      End If
    End Using
    gStatus = CodeLoc & " BeginGetResponse"
    ' Done, invoke user callback
    request.BeginGetResponse(state.userCallback, state.userState)
  End Sub
</code>


Regards

Hans
--
View this message in context:
http://mono.1490590.n4.nabble.com/Mono-Hangs-on-Using-streamResponse-As-Stre
am-request-EndGetRequestStream-result-tp3170875p3170875.html
Sent from the Mono - VB mailing list archive at Nabble.com.
_______________________________________________
Mono-vb mailing list
Mono-vb at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-vb 

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1191 / Virus Database: 1435/3355 - Release Date: 01/02/11

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-vb/attachments/20110103/0fafa9af/attachment.html 


More information about the Mono-vb mailing list