Shalom

Is the memset below needed?  Stevens says sin_zero is
not used.  Others on the newsgroups say clearing the field
is needed on a few platforms.  I've left the memset in just
to be on the safe side.

sock_type cmw::udp_server (uint32_t port)
{
  sock_type sd = getSocket(SOCK_DGRAM);
  sockaddr_in si_me;
  si_me.sin_family = AF_INET;
  si_me.sin_port = htons(port);
  si_me.sin_addr.s_addr = htonl(INADDR_ANY);
  ::std::memset(&si_me.sin_zero, 0, sizeof(si_me.sin_zero));
  if (::bind(sd, (sockaddr*) &si_me, sizeof(si_me))==-1) {
    throw failure("udp Bind errno: ") << GetError();
  }
  return sd;
}


Ebenezer Enterprises
http://webEbenezer.net
_______________________________________________
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to