Mercurial > hg > beaglert
comparison core/UdpServer.cpp @ 124:23137a333c93 scope-refactoring
Implemented destructor of UdpServer which closes the socket
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 22 Aug 2015 02:51:39 +0100 |
parents | 2197435e8fb4 |
children | 719119fb2905 |
comparison
equal
deleted
inserted
replaced
123:d6245d5880c5 | 124:23137a333c93 |
---|---|
11 }; | 11 }; |
12 UdpServer::UdpServer(){ | 12 UdpServer::UdpServer(){ |
13 init(0); | 13 init(0); |
14 } | 14 } |
15 UdpServer::~UdpServer(){ | 15 UdpServer::~UdpServer(){ |
16 printf("Close the socket\n"); | |
17 shutdown(inSocket, 0); //Stop receiving data for this socket. If further data arrives, reject it. | |
16 //TODO: unbind from port. AFAIK, this involves closing the socket, therefore creating the socket should become part of bindToPort | 18 //TODO: unbind from port. AFAIK, this involves closing the socket, therefore creating the socket should become part of bindToPort |
17 }; | 19 }; |
18 bool UdpServer::init(int aPort){ | 20 bool UdpServer::init(int aPort){ |
19 enabled=true; | 21 enabled=true; |
20 stZeroTimeOut.tv_sec = 0; //set timeout to 0 | 22 stZeroTimeOut.tv_sec = 0; //set timeout to 0 |