diff --git a/src/send_mulport.cc b/src/send_mulport.cc index 09d0013..9c44852 100644 --- a/src/send_mulport.cc +++ b/src/send_mulport.cc @@ -53,22 +53,30 @@ class Client { } void Send(const T &val) { - clis_.at(cnt_port_)->Send(&val, sizeof(T)); + int send_port = cnt_port_; + send_port = send_port % all_ports_n_; + clis_.at(send_port)->Send((char *)&val, sizeof(T)); cnt_port_++; cnt_port_ = cnt_port_ % all_ports_n_; } void Send(const std::string &str) { - clis_.at(cnt_port_)->Send(str); + int send_port = cnt_port_; + send_port = send_port % all_ports_n_; + clis_.at(send_port)->Send(str); cnt_port_++; cnt_port_ = cnt_port_ % all_ports_n_; } void Send(const char *str, size_t size) { - clis_.at(cnt_port_)->Send(str, size); + int send_port = cnt_port_; + send_port = send_port % all_ports_n_; + clis_.at(send_port)->Send(str, size); cnt_port_++; cnt_port_ = cnt_port_ % all_ports_n_; } void Send(const char *str) { - clis_.at(cnt_port_)->Send(str); + int send_port = cnt_port_; + send_port = send_port % all_ports_n_; + clis_.at(send_port)->Send(str); cnt_port_++; cnt_port_ = cnt_port_ % all_ports_n_; }