How to check if NAS is available at network (c++)

Hello,
I have a MyCloud EX2.
I want to write a program in c++.
When the NAS ist online, I can check with WinAPI function "PathIsDirectoryA( “\MY_NAS\User_A” ), whether NAS is online.
Then I shutdown NAS with DOS-command: “plink.exe sshd@192.168.xxx.xxx -pw MyPassword halt”.
Electrical power is still on.
How can I check, if NAS is present at network (shutdown, but power on)?
“Wake on LAN” is possible with “wolcmd [mac address] [ip address] [subnet mask] [port number]”
Any hints for me?
Does anybody has windows code for shutdown and Wake-on-LAN?
Many thanks

OK, now I am able to check, if NAS is present in network ( IcmpSendEcho() )
I am able to send a Wake-On-Lan as UDP message.
Does anybody know, how to shutdown? With the tool PLINK.EXE and ssh command it will work, but I will write my own C++ code in my programm.