Avoid socket #0 used by DHCP

This commit is contained in:
Nick Moore 2019-05-02 14:32:35 +10:00
parent 58d1d99701
commit 09b83e96b3

View File

@ -106,8 +106,8 @@ int wiznet5k_socket_socket(mod_network_socket_obj_t *socket, int *_errno) {
} }
if (socket->u_param.fileno == -1) { if (socket->u_param.fileno == -1) {
// get first unused socket number // get first unused socket number ... 0 is reserved for DHCP
for (mp_uint_t sn = 0; sn < _WIZCHIP_SOCK_NUM_; sn++) { for (mp_uint_t sn = 1; sn < _WIZCHIP_SOCK_NUM_; sn++) {
if ((wiznet5k_obj.socket_used & (1 << sn)) == 0) { if ((wiznet5k_obj.socket_used & (1 << sn)) == 0) {
wiznet5k_obj.socket_used |= (1 << sn); wiznet5k_obj.socket_used |= (1 << sn);
socket->u_param.fileno = sn; socket->u_param.fileno = sn;