I'm trying to use a subclass of TCPSocket to handle the transmission of binary data over a given socket. Since it is binary, I'm depending on accessing the return value of the tcp()->read(buffer,size) call to determine how much data I have read, or if I have hit eof.
It appears that the way the tcp() is passed around, my code cannot map to the iostream call that returns the byte count read, as in:
int readbytes = tcp()->read(test,8192);
error: `class istream' used where a `int' was expected
Am I doing something horribly wrong, or is there another mechanism I need to use to get to the byte count read? (I have tried seeing if ios::fail is set, but that doesn't appear to be safe either.)
Thanks for your help, I'm relearning c++ after about a 4 year hiatus, and it's entirely possible that I'm just not back up to speed yet.
--Matt Sherer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to use a subclass of TCPSocket to handle the transmission of binary data over a given socket. Since it is binary, I'm depending on accessing the return value of the tcp()->read(buffer,size) call to determine how much data I have read, or if I have hit eof.
It appears that the way the tcp() is passed around, my code cannot map to the iostream call that returns the byte count read, as in:
int readbytes = tcp()->read(test,8192);
error: `class istream' used where a `int' was expected
Am I doing something horribly wrong, or is there another mechanism I need to use to get to the byte count read? (I have tried seeing if ios::fail is set, but that doesn't appear to be safe either.)
Thanks for your help, I'm relearning c++ after about a 4 year hiatus, and it's entirely possible that I'm just not back up to speed yet.
--Matt Sherer