Thread: linux socket TCP control

  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
    3,445
    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.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    Ticked and off
    Join Date
    Oct 2011
    Location
    La-la land
    Posts
    1,728
    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, 08: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, 08: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