Browse Source

sockets: perform implicit bind during sendto()

A client should not require to explicitly call bind() to receive packets, but is expected to receive replies sent to the ephemeral port that was selected as a source port by the UDP implementation.
cc430
Oleg Hahm 7 years ago
parent
commit
c366f2bbcd
  1. 5
      sys/posix/sockets/posix_sockets.c

5
sys/posix/sockets/posix_sockets.c

@ -728,12 +728,11 @@ ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags,
switch (s->type) {
#ifdef MODULE_CONN_UDP
case SOCK_DGRAM:
if ((res = conn_udp_recvfrom(&s->conn.udp, buffer, length, addr, &addr_len,
port)) < 0) {
if ((res = conn_udp_recvfrom(&s->conn.udp, buffer, length, addr,
&addr_len, port)) < 0) {
errno = -res;
return -1;
}
break;
#endif
#ifdef MODULE_CONN_IP

Loading…
Cancel
Save