I am working on a client-server application in C and on Linux platform.What I am trying to achieve is to change the socket id over a TCP connection on client side which sends the data from a file to the server.The application is multithreaded and the other thread changes the socket id based on some global flags set.
Problem: The data is transferred initially over IPv4 socket connection and when the global flags are set , I start sending data on IPv6 socket. but the problem is I am not able to receive the entire data on IPv6 connection. When I send the data purely and only over IPv6 connection there is no packet loss. I can see there is no loss of data when the sockets id is switched but down the line the packets coming afterwards are get lost(Not all of them).
I also check for the errno using perror but it says "ESPIPE:Illegal seek", but this error exists even before switching. Any help is highly appreciated as I am stuck on this issue for a long time now.
(I am using a pointer variable in send function on server side send(*p_dataSocket.socket_id,sentence,p_size,0); to change the pointer to IPv6 socket ID on the fly)