| 71 | |
| 72 | |
| 73 | void RemoteSyslogChannel::open() |
| 74 | { |
| 75 | if (_open) return; |
| 76 | |
| 77 | if (_logHost.find(':') != std::string::npos) |
| 78 | _socketAddress = SocketAddress(_logHost); |
| 79 | else |
| 80 | _socketAddress = SocketAddress(_logHost, SYSLOG_PORT); |
| 81 | |
| 82 | // reset socket for the case that it has been previously closed |
| 83 | _socket = DatagramSocket(_socketAddress.family()); |
| 84 | |
| 85 | if (_host.empty()) |
| 86 | { |
| 87 | try |
| 88 | { |
| 89 | _host = DNS::thisHost().name(); |
| 90 | } |
| 91 | catch (Poco::Exception&) |
| 92 | { |
| 93 | _host = _socket.address().host().toString(); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | _open = true; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | void RemoteSyslogChannel::close() |