Subj : Re: pread/pwrite To : comp.programming.threads From : Peter Julian Date : Wed May 25 2005 10:37 pm "Lyonya" wrote in message news:OF7le.26169$NZ1.8906@fe09.lga... > can pread/pwrite operate on sockets the way they work with files? Not in the case of pread or pwrite. That doesn't prevent you from overloading operator<< and operator>> to stream the socket data to/from a std buffer, for example. The choice of buffers you might implement could be std::stringstream or just a plain std::string, amongst other choices. Socket& operator<<( const std::string& data); // write a string to socket Socket& operator<<( const char* data); // write a char* to a socket Socket& operator>>( std::string& data); // read a string from a socket or even templated to transfer various datatypes: template Socket& MySocket::operator<<(T& data) { std::ostringstream os; os << data; std::string s(os.str()); send( fd, s.c_str(), s.length()); } the objects os and s might also be made members of the MySocket class instead of temporaries. etc... .