To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=46752
Issue #:|46752
Summary:|com.sun.star.connection.Connector read stops with
|error
Component:|api
Version:|680m78
Platform:|PC
URL:|
OS/Version:|Windows 98
Status:|UNCONFIRMED
Status whiteboard:|
Keywords:|
Resolution:|
Issue type:|DEFECT
Priority:|P3
Subcomponent:|definition
Assigned to:|mi
Reported by:|ms7777
------- Additional comments from [EMAIL PROTECTED] Tue Apr 5 15:20:34 -0700
2005 -------
The com.sun.star.connection.Connector could be a very helpful tool to directly
access http connections. It is severly limited by the inability to read data,
when the stream size is not known, however.
If the target read length is larger than the bytes available, an error occurs.
Expected behavior would be that no error occurs, and that the return value of
oConnection.read( aByteArray, nBytes) is below nBytes.
The Error shown is
BASIC runtime error
An exception occured
Type: com.sun.star.io.IOException
Message: ctr_socket.cxx:SocketConnection::read: error - Unknown WinSock Error
Number 0
Some BASIC sample code:
sub main
'The following works
call ReadNBytesFromYahoo(200)
'The following ends with an error
call ReadNBytesFromYahoo(30000)
end sub
Sub ReadNBytesFromYahoo(nBytes as long)
cCR = Chr(13)
cLF = Chr(10)
oConnector = createUnoService( "com.sun.star.connection.Connector" )
oConnection = oConnector.connect("socket,host=www.yahoo.com,port=80")
oConnection.write( StringToByteArray( "GET / HTTP/1.0" + cCR + cLF+ cCR +
cLF ) )
aByteArray = Array()
nBytesRead = oConnection.read( aByteArray, nBytes)
End Sub
Function StringToByteArray( ByVal cString As String )
nNumBytes = Len( cString )
Dim aBytes(nNumBytes-1) As Integer
For i = 1 To nNumBytes
cChar = Mid( cString, i, 1 )
nByte = Asc( cChar )
nByte = IntegerToByte( nByte )
aBytes(i-1) = nByte
Next
StringToByteArray() = aBytes()
End Function
Function IntegerToByte( ByVal nByte As Integer ) As Integer
If nByte > 127 Then
nByte = nByte - 256
EndIf
IntegerToByte() = nByte
End Function
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]