byte download from the server | developer.brewmp.com byte download from the server | developer.brewmp.com

Developer

byte download from the server

Forums:

Hi,

I'm using the ISocket_Read() to read the data from a file in the server. (FTP server)
The data may be from a .txt or from a .doc or from a .jpg file.

I'm using ISocket_read to read the contents, store it in a buffer and send it to another PC where it would be written to another file.

When i open the file (which is written with the socket data now) in the PC, i'm seeing the line space characters printed (in the form of small rectangles).

Does using IAStream solve my problem?
If yes, In my case how to use the IAStream as i've to fetch the data from the server (for which i've already established the connection using socket)

Please help me

Thanks,
Celia

Refer to the BREW programming API reference guide:
To use an IAStream instance to retrieve data asynchronously
1. Call ISHELL_CreateInstance() to create an instance of a class that implements the IAStream interface.
2. Call IASTREAM_Read() to read the required number of bytes of data from the stream. Because IAStream Interface is an abstract interface, call IFILE_Read() for files, or ISOCKET_Read() for sockets.
3. If IASTREAM_Read() returns AEE_STREAM_WOULDBLOCK, call IASTREAM_Readable() to schedule a callback to try again later.
4. If IASTREAM_Read() reads fewer than the required number of bytes, call the function again to read the remaining data.
5. Repeat steps 2-4 until all the data has been received on the stream.

Refer to the BREW programming API reference guide:
To use an IAStream instance to retrieve data asynchronously
1. Call ISHELL_CreateInstance() to create an instance of a class that implements the IAStream interface.
2. Call IASTREAM_Read() to read the required number of bytes of data from the stream. Because IAStream Interface is an abstract interface, call IFILE_Read() for files, or ISOCKET_Read() for sockets.
3. If IASTREAM_Read() returns AEE_STREAM_WOULDBLOCK, call IASTREAM_Readable() to schedule a callback to try again later.
4. If IASTREAM_Read() reads fewer than the required number of bytes, call the function again to read the remaining data.
5. Repeat steps 2-4 until all the data has been received on the stream.

I'm not sure what your problem is, but I don't see how using IAStream would fix it.
-Erik

I'm not sure what your problem is, but I don't see how using IAStream would fix it.
-Erik