// ********************************************************************** // // Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. // // This copy of Ice-E is licensed to you under the terms described in the // ICEE_LICENSE file included in this distribution. // // ********************************************************************** #ifndef ICEE_TRANSCEIVER_H #define ICEE_TRANSCEIVER_H #include #include #include #include #include #ifdef _WIN32 # include typedef int ssize_t; #else # define SOCKET int #endif namespace IceInternal { class Connector; class Acceptor; class Buffer; class ICE_API Transceiver : public ::IceUtil::Shared { public: SOCKET fd(); void close(); void shutdownWrite(); void shutdownReadWrite(); void writeWithTimeout(Buffer&, int); void readWithTimeout(Buffer&, int); void write(Buffer& buf) { writeWithTimeout(buf, _timeout); } void read(Buffer& buf) { readWithTimeout(buf, _timeout); } std::string type() const; std::string toString() const; private: Transceiver(const InstancePtr&, SOCKET, int); virtual ~Transceiver(); friend class Connector; friend class Acceptor; #ifdef ICEE_USE_SELECT_FOR_TIMEOUTS void doSelect(bool, int); #endif const TraceLevelsPtr _traceLevels; const Ice::LoggerPtr _logger; SOCKET _fd; const int _timeout; #ifdef ICEE_USE_SELECT_FOR_TIMEOUTS #ifdef _WIN32 WSAEVENT _event; WSAEVENT _readEvent; WSAEVENT _writeEvent; #else fd_set _wFdSet; fd_set _rFdSet; #endif #endif const std::string _desc; #ifdef _WIN32 const bool _isPeerLocal; #endif }; } #endif