From b552a96508119a6e3d67426ead88712fa655eaa5 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 15 May 2022 10:36:48 -0400 Subject: [PATCH] cwSocket.cpp : Generate an error message if _idToSock() fails in _getMgrAndSocket(). --- cwSocket.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cwSocket.cpp b/cwSocket.cpp index 9aff00f..1e3f58f 100644 --- a/cwSocket.cpp +++ b/cwSocket.cpp @@ -85,7 +85,8 @@ namespace cw { p = _handleToPtr(h); if((s = _idToSock(p,userId,showErrorFl)) == nullptr ) - return kInvalidArgRC; + return cwLogError(kInvalidArgRC,"The socket associated with id '%i' could not be found.",userId); + return kOkRC; } @@ -635,7 +636,7 @@ cw::rc_t cw::sock::create( handle_t h, int type = cwIsFlag(flags,kStreamFl) ? SOCK_STREAM : SOCK_DGRAM; - int protocol = cwIsFlag(flags,kTcpFl) ? 0 : IPPROTO_UDP; + int protocol = cwIsFlag(flags,kTcpFl) ? 0 : IPPROTO_UDP; // get a handle to the socket if(( s->sockH = ::socket( AF_INET, type, protocol ) ) == cwSOCKET_SYS_ERR )