I wanted to use ntohs initially, but the following section in the Remarks forced me to ask here for help:
If the netshort parameter is already in host byte order, then this function will reverse it. It is up to the application to determine if the byte order must be reversed.
I could try something like this:
short int i= 0x1;
char *c= (char*)&i;
if(c[0] == 1) // little endian, use ntohs
but I was wondering if there is Winsock API function that does the same?