You don't need to declare an array the size of the ID returned and would almost certainly be quite wasteful if you did.
If you only want to store the ID then just
sockets_connections_id[0_or_whatever_connection_number_this_one_is] = SocketIDReturned
If you want to store more information than just socket ID then define a type
Type TSocketConnInfo
SocketID as Integer
SomethingElseYouWantToTrack as String
SomethingElseYouWantToTrack2 as Integer
EndType
#constant MAX_CONNECTIONS_YOU_WANT_TO_SUPPORT = 10
Global SocketConnections as TSocketConnInfo[MAX_CONNECTIONS_YOU_WANT_TO_SUPPORT]
SocketConnections[0_or_whatever_connection_number_this_one_is].SocketID = SocketIDReturned
I wrote this on cell phone so quite likely errors but that it illustrates the idea.
Oh just realized you said C++ so just use struct instead of type, etc.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)