MCPcopy Create free account
hub / github.com/dermesser/libsocket / connect

Method connect

C++/inetclientdgram.cpp:166–181  ·  view source on GitHub ↗

* @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 */

Source from the content-addressed store, hash-verified

164 * @param dstport Destination port
165 */
166void 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.

Callers 1

mainFunction · 0.45

Calls 2

socket_exceptionClass · 0.85

Tested by

no test coverage detected