The function returns the following error codes:
0 ... everything is OK -1 ... not connected -2 ... undefined error