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. Error in recv()

Error in recv()

Scheduled Pinned Locked Moved C / C++ / MFC
helpsysadmintutorialquestion
4 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.
  • W Offline
    W Offline
    wrjksdf
    wrote on last edited by
    #1

    Hi, I have created a TCP connection between client and server. On client system I do socket(), bind(), connect() and recv()/send(). I do recv() and send() simultaneously in two threads. The program works fine for some time (1-2 minutes), but after some time, recv() returns SOCKET_ERROR. WSAGetLastError() returns error code of 12. Any suggestions on how to solve this problem? I am sending about 20 packets per second (at a rate of 100kbps). I am receiving about same number of packets although bitrate is much lesser. Any help will be highly appreciated. Thanks very much in advance. Regards RS

    R 1 Reply Last reply
    0
    • W wrjksdf

      Hi, I have created a TCP connection between client and server. On client system I do socket(), bind(), connect() and recv()/send(). I do recv() and send() simultaneously in two threads. The program works fine for some time (1-2 minutes), but after some time, recv() returns SOCKET_ERROR. WSAGetLastError() returns error code of 12. Any suggestions on how to solve this problem? I am sending about 20 packets per second (at a rate of 100kbps). I am receiving about same number of packets although bitrate is much lesser. Any help will be highly appreciated. Thanks very much in advance. Regards RS

      R Offline
      R Offline
      Robert Palma Jr
      wrote on last edited by
      #2

      What are the sizes of the packets? Do they change? You need to print the error message text. I think 12 is: WSAEMSGSIZE The message was too large to fit into the specified buffer and was truncated. But I'm not sure. The above is in the MSDN for recv(). FUNNY, I am chasing a recv() error right now myself! My post is just a few after yours :-)

      W 1 Reply Last reply
      0
      • R Robert Palma Jr

        What are the sizes of the packets? Do they change? You need to print the error message text. I think 12 is: WSAEMSGSIZE The message was too large to fit into the specified buffer and was truncated. But I'm not sure. The above is in the MSDN for recv(). FUNNY, I am chasing a recv() error right now myself! My post is just a few after yours :-)

        W Offline
        W Offline
        wrjksdf
        wrote on last edited by
        #3

        > What are the sizes of the packets? > Do they change? Initially the packet sizes are about 8-10 bytes. Later packet sizes increase to 600-800 bytes. When the packet size is small and packets per second are low, the error is generated after a longer time. When packet size increases the error is generated in a very short time. Also I am using TCP port 80.

        W 1 Reply Last reply
        0
        • W wrjksdf

          > What are the sizes of the packets? > Do they change? Initially the packet sizes are about 8-10 bytes. Later packet sizes increase to 600-800 bytes. When the packet size is small and packets per second are low, the error is generated after a longer time. When packet size increases the error is generated in a very short time. Also I am using TCP port 80.

          W Offline
          W Offline
          wrjksdf
          wrote on last edited by
          #4

          Also if I use port such as 5000 the program works fine. Thanks a lot. Regards, RS

          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