Changeset 387 in flair-src for trunk/lib/FlairCore/src


Ignore:
Timestamp:
Dec 21, 2020, 2:49:53 PM (4 years ago)
Author:
Sanahuja Guillaume
Message:

resolve bug with udp broadcast

Location:
trunk/lib/FlairCore/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/UdpSocket.cpp

    r363 r387  
    4343}
    4444
    45 void UdpSocket::SendMessage(string message) { pimpl_->SendMessage(message); }
     45void UdpSocket::SendMessage(string message,int dst_id) { pimpl_->SendMessage(message,dst_id); }
    4646
    4747ssize_t UdpSocket::RecvMessage(char *buf, size_t buf_len, Time timeout, char *src,
  • trunk/lib/FlairCore/src/UdpSocket.h

    r363 r387  
    6666  *
    6767  * \param message message
     68  * \param dst_id id of the dst if multiple connection (quick and dirty hack for sido, only works on NRT)
    6869  */
    69   void SendMessage(std::string message);
     70  void SendMessage(std::string message,int dst_id=0);
    7071
    7172  /*!
  • trunk/lib/FlairCore/src/UdpSocket_impl.cpp

    r364 r387  
    192192}
    193193
    194 void UdpSocket_impl::SendMessage(string message) {
     194void UdpSocket_impl::SendMessage(string message,int dst_id) {
    195195  ssize_t written;
    196196
     
    208208  }
    209209#else
    210   written = sendto(fd, message.c_str(), message.size(), 0, (struct sockaddr *)&sock_in, sizeof(struct sockaddr_in));
     210  written = sendto(fd, message.c_str(), message.size(), 0,(struct sockaddr *)&(sock_in[dst_id]), sizeof(struct sockaddr_in));
    211211  if (written != (ssize_t)message.size()) {
    212     self->Err("sendto error\n");
     212    self->Err("sendto error %i/%i\n",written,(ssize_t)message.size());
    213213  }
    214214
  • trunk/lib/FlairCore/src/unexported/UdpSocket_impl.h

    r363 r387  
    3232  ~UdpSocket_impl();
    3333
    34   void SendMessage(std::string message);
     34  void SendMessage(std::string message,int dst_id);
    3535  void SendMessage(const char *msg, size_t msg_len,int dst_id);
    3636  ssize_t RecvMessage(char *msg, size_t msg_len, flair::core::Time timeout,
Note: See TracChangeset for help on using the changeset viewer.