Home/Support/Support Forum/Sample program to connect to Raw TCP (2101) connectport TS16
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

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

0 votes
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?
asked Apr 5, 2018 in Other/Legacy by sateesh New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
I tried this program it works well.
answered Apr 6, 2018 by Caolinejesi New to the Community (1 point)
...