cwIo.h/cpp : Added socketIsConnected().

This commit is contained in:
kevin 2022-11-14 18:32:32 -05:00
parent 4aa8621b70
commit eb674c8411
2 changed files with 12 additions and 0 deletions

View File

@ -2576,6 +2576,16 @@ cw::rc_t cw::io::socketPeername( handle_t h, unsigned sockIdx, struct sockaddr_i
return sock::peername( p->sockH, s->userId, addr ); return sock::peername( p->sockH, s->userId, addr );
} }
bool cw::io::socketIsConnected( handle_t h, unsigned sockIdx )
{
io_t* p = _handleToPtr(h);
socket_t* s;
if((s = _socketIndexToRecd(p,sockIdx)) == nullptr )
return sock::isConnected( p->sockH, s->userId );
return false;
}
cw::rc_t cw::io::socketSend( handle_t h, unsigned sockIdx, unsigned connId, const void* data, unsigned dataByteCnt ) cw::rc_t cw::io::socketSend( handle_t h, unsigned sockIdx, unsigned connId, const void* data, unsigned dataByteCnt )
{ {
io_t* p = _handleToPtr(h); io_t* p = _handleToPtr(h);

2
cwIo.h
View File

@ -251,6 +251,8 @@ namespace cw
unsigned socketInetAddress( handle_t h, unsigned sockIdx ); unsigned socketInetAddress( handle_t h, unsigned sockIdx );
sock::portNumber_t socketPort( handle_t h, unsigned sockIdx ); sock::portNumber_t socketPort( handle_t h, unsigned sockIdx );
rc_t socketPeername( handle_t h, unsigned sockIdx, struct sockaddr_in* addr ); rc_t socketPeername( handle_t h, unsigned sockIdx, struct sockaddr_in* addr );
bool socketIsConnected( handle_t h, unsigned sockIdx );