Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. SO_RCVTIMEO not working for nonblocking win32 socket

SO_RCVTIMEO not working for nonblocking win32 socket

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    onlyjaypatel
    wrote on last edited by
    #1

    Hello, I had set timeout with int n = 20000; setsockopt(ClientSocket,SOL_SOCKET,SO_RCVTIMEO,(char*)&n,sizeof(int); and set mode nonblocking with function call int iMode = 1; ioctlsocket(ClientSocket,FIONBIO,(u_long FAR*)&iMode) if i set mode to nonblocking than timeout is not called in recv(). but if i do it with mode blocking (default) than every thing is working fine and timeout called.but i have to work with non blocking mode so anybody can tell me how can i set timeout in nonblocking socket. or why i dont get timeout ,i missed something plz reply. Thanx in advance. :)

    S 1 Reply Last reply
    0
    • O onlyjaypatel

      Hello, I had set timeout with int n = 20000; setsockopt(ClientSocket,SOL_SOCKET,SO_RCVTIMEO,(char*)&n,sizeof(int); and set mode nonblocking with function call int iMode = 1; ioctlsocket(ClientSocket,FIONBIO,(u_long FAR*)&iMode) if i set mode to nonblocking than timeout is not called in recv(). but if i do it with mode blocking (default) than every thing is working fine and timeout called.but i have to work with non blocking mode so anybody can tell me how can i set timeout in nonblocking socket. or why i dont get timeout ,i missed something plz reply. Thanx in advance. :)

      S Offline
      S Offline
      SandipG
      wrote on last edited by
      #2

      one Suggestion re posting questions will not help you to get answers. Now i am not sure if this will answer the problem but i will try. 1. Blocking socket and time out set. This is ideal condition since it is a blocking call After timeout it will come out of the blocking call if nothing to receive. 2. Non blocking and time out set. Since this is the non blocking call it will come out immediately so there is no need of timeout rather even if it is set you will not get it because if there is nothing to receive call will return.. I hope that makes sense.

      Regards, Sandip.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups