Sample program to connect to Raw TCP (2101) connectport TS16

For sending serial data over TCP using RAW TCP port for example 2101 to connect to serial port ttyt0/t1, I used SOCK_STREAM and connecting to port 2101 like the below. Would be great if any sample program digi can provide to connect to raw TCP ports.

            fd = socket(AF_INET, SOCK_STREAM, 0);               
            sa1.sin_family = AF_INET;
            sa1.sin_addr.s_addr = IP;
            sa1.sin_port = htons(port);
            connect(fd, (struct sockaddr*)&sa1, sizeof(struct sockaddr_in));

Should I use SOCK_RAW creating each packet with TCP, IP headers instead of SOCK_STREAM?

I tried this program it works well.