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.
This commit is contained in:
parent
0153933241
commit
c366f2bbcd
@ -728,12 +728,11 @@ ssize_t recvfrom(int socket, void *restrict buffer, size_t length, int flags,
|
|||||||
switch (s->type) {
|
switch (s->type) {
|
||||||
#ifdef MODULE_CONN_UDP
|
#ifdef MODULE_CONN_UDP
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
if ((res = conn_udp_recvfrom(&s->conn.udp, buffer, length, addr, &addr_len,
|
if ((res = conn_udp_recvfrom(&s->conn.udp, buffer, length, addr,
|
||||||
port)) < 0) {
|
&addr_len, port)) < 0) {
|
||||||
errno = -res;
|
errno = -res;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MODULE_CONN_IP
|
#ifdef MODULE_CONN_IP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user