recvTimeval_.tv_usec = (int)((recvTimeout_%1000)*1000);
}
+TSocket::TSocket() :
+ host_(""),
+ port_(0),
+ socket_(0),
+ connTimeout_(0),
+ sendTimeout_(0),
+ recvTimeout_(0),
+ lingerOn_(1),
+ lingerVal_(0),
+ noDelay_(1) {
+ recvTimeval_.tv_sec = (int)(recvTimeout_/1000);
+ recvTimeval_.tv_usec = (int)((recvTimeout_%1000)*1000);
+}
+
TSocket::TSocket(int socket) :
host_(""),
port_(0),
}
}
+void TSocket::setHost(string host) {
+ host_ = host;
+}
+
+void TSocket::setPort(int port) {
+ port_ = port;
+}
+
void TSocket::setLinger(bool on, int linger) {
lingerOn_ = on;
lingerVal_ = linger;
friend class TServerSocket;
public:
+ /**
+ * Constructs a new socket. Note that this does NOT actually connect the
+ * socket.
+ *
+ */
+ TSocket();
+
/**
* Constructs a new socket. Note that this does NOT actually connect the
* socket.
*/
TSocket(std::string host, int port);
+
/**
* Destroyes the socket object, closing it if necessary.
*/
*/
void write(const uint8_t* buf, uint32_t len);
+ /**
+ * Set the host that socket will connect to
+ *
+ * @param host host identifier
+ */
+ void setHost(std::string host);
+
+ /**
+ * Set the port that socket will connect to
+ *
+ * @param port port number
+ */
+ void setPort(int port);
+
/**
* Controls whether the linger option is set on the socket.
*