| 46 | } |
| 47 | |
| 48 | void LCDConnection::initialize() { |
| 49 | memset(&_addr, 0, sizeof (_addr)); |
| 50 | |
| 51 | if (!isValid()) { |
| 52 | throw LCDException(LCD_SOCKET_CREATION_ERROR); |
| 53 | } |
| 54 | |
| 55 | const int on = 1; |
| 56 | if (setsockopt(_sock, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char*>(&on), sizeof (on)) == -1) { |
| 57 | throw LCDException(LCD_SOCKET_CREATION_ERROR); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | bool LCDConnection::isValid() const { |
| 62 | return _sock != -1; |
nothing calls this directly
no test coverage detected