Mercurial > hg > beaglert
diff core/UdpServer.cpp @ 53:6907e2177eb8 ultra-staging
Fixed bugs in Udp classes, updated tests
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sun, 07 Jun 2015 14:58:34 +0100 |
parents | f5b5c648cd5d |
children | d3f869b98147 |
line wrap: on
line diff
--- a/core/UdpServer.cpp Wed May 20 18:07:16 2015 +0100 +++ b/core/UdpServer.cpp Sun Jun 07 14:58:34 2015 +0100 @@ -34,11 +34,16 @@ bool UdpServer::bindToPort(int aPort){ port=aPort; + if(port<1){ + enabled=false; + return false; + } server.sin_port=htons(port); if (bind(inSocket,(struct sockaddr *)&server,length)<0){ enabled=false; return false; } + enabled=true; return true; }; int UdpServer::read(//Returns the number of bytes read, or -1 if there was an error.