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. timeout recv on udp socket

timeout recv on udp socket

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
2 Posts 2 Posters 2 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
    orcun colak
    wrote on last edited by
    #1

    When I create a udp socket and then bind to port 0 and set receive timeout to 5 seconds and then call recv it the recv does not wait 5 secs but returns immediately. When I check the error code with WSAGetLastError the error code is WSAECONNRESET. Why is the connections reset ? I am using UDP and I am not connected . What I am doing wrong ? Here are the steps again 1) Create a UDP 2) Bind to 0 3) Send something to a destination address 4) setsockopt SO_RCVTIMEO to 5 secs. 5) try to recv something within 5 secs. But here it returns WSAECONNRESET !!! What is wrong ? Orcun Colak

    A 1 Reply Last reply
    0
    • O orcun colak

      When I create a udp socket and then bind to port 0 and set receive timeout to 5 seconds and then call recv it the recv does not wait 5 secs but returns immediately. When I check the error code with WSAGetLastError the error code is WSAECONNRESET. Why is the connections reset ? I am using UDP and I am not connected . What I am doing wrong ? Here are the steps again 1) Create a UDP 2) Bind to 0 3) Send something to a destination address 4) setsockopt SO_RCVTIMEO to 5 secs. 5) try to recv something within 5 secs. But here it returns WSAECONNRESET !!! What is wrong ? Orcun Colak

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      The recv function is called by TCP sockets. When using a UDP socket, you should call the recvfrom function.

      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