Hello,
It seems that you have already managed to send command via GPRS. If not, in order to send "setdigout ??1 1" via GPRS you have to use Codec 12 protocol:
https://wiki.teltonika-gps.com/view/Teltonika_Data_Sending_Protocols#Codec_12
Regarding a socket, you are correct, socket will close if there is no data sent from device side. For that timeout "Open Link Timeout" parameter is responsible (GPRS settings). The maximum timeout you can set is "259200" seconds, also timeout will reset if any new data is sent from device, which usually means a link with a server will be always opened. Another part that I must mention that the link can be closed from server or operator side. If you control a server side you can develop that the link with device will not be closed. And for operator side, if you have issues that operator is closing a link then I would suggest you to use "Network ping timeout" parameter.
As I wrote above, the socket will be opened after device sends data to server, that could be either periodical or eventual data. It's possible to send SMS command to trigger an event, but I don't think that this solution is efficient. Just to be clear it's not possible to open a link from server using GPRS commands.
I see that you have concerns to leave a socket open, but I must correct you that device will receive commands only from a server that is connected to, which means that an outsider couldn't open a car using GPRS commands.
Best regards
V