linux socket TCP control

This is a discussion on linux socket TCP control within the Linux Programming forums, part of the Platform Specific Boards category; Hi, In TCP protocol, it send the data to server and receive acknowledgement. if failed receive acknowledgement, then it will ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    3

    linux socket TCP control

    Hi,
    In TCP protocol, it send the data to server and receive acknowledgement. if failed receive acknowledgement, then it will send again same data. it will try this for certain time. how can i control in socket created in linux? not seen any option in setsockopt function. is there any function exist to control this?



    --------------
    Linux Learner

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,426
    TCP is a connection-based protocol. it has built-in automatic retry when data isn't received. there is nothing you need to do. just send the data, and let TCP do its job.
    Code:
    namespace life
    {
        const bool change = true;
    }

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    847
    The valid options for setsockopt() in Linux for TCP sockets are listed in man 7 tcp, man 7 ip, and man 7 socket.

    Quote Originally Posted by learner71 View Post
    if failed receive acknowledgement, then it will send again same data. it will try this for certain time. how can i control in socket created in linux?
    Use
    setsockopt(socketfd, SOL_SOCKET, SO_SNDTIMEO, (struct timeval *)&timeout, sizeof (struct timeval))

    There is also the SO_RCVTIMEO option for limiting the time how long a read()/recv()/recvfrom() call waits for data to arrive, before giving up.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux Socket Nightmare
    By Kazansky in forum C Programming
    Replies: 9
    Last Post: 05-10-2012, 09:26 PM
  2. c++ socket in linux
    By mahi in forum C++ Programming
    Replies: 1
    Last Post: 12-21-2011, 07:59 AM
  3. Linux raw socket
    By odomae in forum Networking/Device Communication
    Replies: 3
    Last Post: 05-15-2011, 11:06 PM
  4. Linux raw socket programming
    By cnb in forum Networking/Device Communication
    Replies: 17
    Last Post: 11-08-2010, 07:56 AM
  5. Socket Programming using C on linux
    By mgnidhi_3july in forum C Programming
    Replies: 2
    Last Post: 05-18-2010, 03:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21