CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: TCP-IPv6

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Question TCP-IPv6

    Hello gurus,

    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)

  2. #2
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: TCP-IPv6

    Quote Originally Posted by Goku@nerd View Post
    .... 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).
    In the context of TCP, your mention of the word "packet" raises a red flag.

    Please confirm that you understand that TCP is a stream-based protocol and not a message-based protocol, and that you understand the implications of stream vs. message/packet protocols.

    Please also describe briefly the nature of the application-level protocol that you are using to serialize and deserialize data sent over TCP.

    Mike

  3. #3
    Join Date
    Dec 2011
    Posts
    2

    Re: TCP-IPv6

    Thanks for the reply @MikeAThon. I understand that TCP is stream oriented , but I send a definite amount of data over each send call. I may or may not receive the same amount of data depending on my buffer size, Nagle algo settings, fragmentation due to underlying network, etc. So I refer to it as packets for each send call.
    Adding to the explanation, I have two TCP socket connections established, namely using over IPv4 and IPv6 paths. I am transferring a file over the TCP-IPv4 connection first in the main thread. The other thread is checking on some global flags and has access to/share the socket IDs created for each protocol in main thread. The send and recv use a pointer variable in its call to point to the socket ID to be used for the communication.The data is transferred initially over TCP-Ipv4 .Once the global flags are set and few other checks are made the other thread changes the socket ID used in send call to point to IPv6 socket.I am getting all the data over IPv4 completely sent before switching.Also I am getting data sent over Ipv6 after the socket ID is just switched . But down the transfer there is loss of data over IPv6 connection.
    I am using pselect() to check for the available data for each socket.
    I can somehow understand the data loss while switching but I am not able to figure out why the data loss is occurring down the transfer after switching.I hope I am clear on what the issue is. I have also checked to send the data individually over each protocol without switch and there is no data loss. Also would really appreciate to know to how to investigate in this issue apart from using "errno" or netstat . Thanks


    values for socket() call
    Domain : AF_INET6/AF_INET
    Type : SOCK_STREAM
    protocol : 0

  4. #4
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: TCP-IPv6

    Quote Originally Posted by Goku@nerd View Post
    Thanks for the reply @MikeAThon. I understand that TCP is stream oriented , but I send a definite amount of data over each send call. I may or may not receive the same amount of data depending on my buffer size, Nagle algo settings, fragmentation due to underlying network, etc. So I refer to it as packets for each send call. ...
    That's a good answer, and it's clear that you understand the implications of TCP being a stream protocol. I'm sorry that I had to ask, but as I said, your initial mention of "packets" set off a red flag on a common misunderstanding of many newcomers to socket programming.

    That said, I unfortunately have nothing to more to add. I am unfamiliar with IPv6 and with a transition from IPv4 to IPv6 during a connection.

    Sorry,
    Mike

    PS: As a debugging aid, you might consider the Wireshark packet sniffer, to determine whether the missing bytes ever even reach the wire, although I suspect that you already know about Wireshark

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured