* @brief Connect datagram socket. * * Connect a datagram socket to a remote peer so only its packets are received * and all data written is sent to it. * * @param dsthost Destination host * @param dstport Destination port */
| 164 | * @param dstport Destination port |
| 165 | */ |
| 166 | void inet_dgram_client::connect(const char* dsthost, const char* dstport) { |
| 167 | if (sfd == -1) |
| 168 | throw socket_exception( |
| 169 | __FILE__, __LINE__, |
| 170 | "inet_dgram_client::connect() - Socket has already been closed!", |
| 171 | false); |
| 172 | if (-1 == (connect_inet_dgram_socket(sfd, dsthost, dstport))) |
| 173 | throw socket_exception( |
| 174 | __FILE__, __LINE__, |
| 175 | "inet_dgram_client::connect() - Could not connect dgram socket! " |
| 176 | "(Maybe this socket has a wrong address family?)"); |
| 177 | |
| 178 | host = dsthost; |
| 179 | port = dstport; |
| 180 | connected = true; |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * @brief Connect datagram socket. |
no test coverage detected