Skip to content

Commit

Permalink
test binding udp port
Browse files Browse the repository at this point in the history
  • Loading branch information
wgtdkp committed Apr 30, 2024
1 parent 79d1ddc commit d393111
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/library/coap_secure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ class CoapSecure

void Connect(DtlsSession::ConnectHandler aOnConnected, const std::string &aPeerAddr, uint16_t aPeerPort)
{
if (int fail = mSocket->Bind("::", 0))
{
if (aOnConnected != nullptr)
{
aOnConnected(mDtlsSession, ERROR_IO_ERROR("bind to [::]:0 failed: {}",
aPeerAddr, aPeerPort, fail));
ExitNow();
}
}

if (int fail = mSocket->Connect(aPeerAddr, aPeerPort))
{
if (aOnConnected != nullptr)
Expand Down

0 comments on commit d393111

Please sign in to comment.