Skip to content

Commit

Permalink
return success from UDP.begin()
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mcgowan committed Aug 20, 2015
1 parent 2978a3f commit 690322a
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions wiring/src/spark_wiring_udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ UDP::UDP() : _sock(socket_handle_invalid())
uint8_t UDP::begin(uint16_t port, network_interface_t nif)
{
bool bound = 0;
if(Network.from(nif).ready())
{
_sock = socket_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, port, nif);
DEBUG("socket=%d",_sock);
if (socket_handle_valid(_sock))
{
flush();
_port = port;
_nif = nif;
}
}
if(Network.from(nif).ready())
{
_sock = socket_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, port, nif);
DEBUG("socket=%d",_sock);
if (socket_handle_valid(_sock))
{
flush();
_port = port;
_nif = nif;
bound = 1;
}
}
return bound;
}

Expand Down

0 comments on commit 690322a

Please sign in to comment.