Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 345391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:04:46+00:00 2026-05-12T11:04:46+00:00

I seem to be getting this particular always when i am trying to receive

  • 0

I seem to be getting this particular always when i am trying to receive data in that socket. The socket is a valid socket and connection is also established and there is some data always that periodically comes in theparticular port. But some how the recv function gives this error. Any idea what may be the cause.

sample code present below.

thanks in advance

struct hostent      *hdata;                             // Used when Node name is converted to IP-Address
struct sockaddr_in   insock;                            // Socket address structure
unsigned long        ipaddr;                            // IP-Address in numeric format
CString sIPAddr = _T("1.1.1.1");
char * cSBCS = (char*)sIPAddr.GetBuffer(sIPAddr.GetLength());
ipaddr = inet_addr( cSBCS/*sIPAddr*/ );

hdata = gethostbyname( sIPAddr );

insock.sin_family   = AF_INET;
insock.sin_port     = htons( 2101 );
memcpy( &insock.sin_addr, *(hdata->h_addr_list), hdata->h_length );


    // Create socket
if(( m_Socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP )) == INVALID_SOCKET );
//  return FALSE;

// Connect to MSS-box
if(( connect( m_Socket, (struct sockaddr *)&insock, sizeof( insock ))) == SOCKET_ERROR )
DWORD dwNonBlocking = -1;
if( ioctlsocket( m_Socket, FIONBIO, &dwNonBlocking ))

if((pdwRxChars = recv( m_Socket, pRxBuffer,1024, 0)) == SOCKET_ERROR )

always getting WSAEWOULDBLOCK error

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:04:47+00:00Added an answer on May 12, 2026 at 11:04 am

    You are setting socket to NON-BLOCKING:

    DWORD dwNonBlocking = -1;
    ioctlsocket( m_Socket, FIONBIO, &dwNonBlocking )
    

    and then you try to use blocking recv() – in that case you will always get this error.

    Look at asynchronous functions such as select, WSARecv…

    Or disable Non-Blocking mode setting dwNonBlocking to zero.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this NPE in my application and I can't seem to get
This may seem like a simple question but i am getting an error when
This might seem ridiculously simple, but I've been getting all kinds of error depending
I seem to be getting a type mismatch error when trying to do something
This is my first time trying to use both ARC and Core Data. I
I seem to be getting a strange error when I run my tests in
I seem to be getting breakpoints from other programmers when checking out code... Where
I seem to have a problem with getting MVC to fill in my custom
I am getting very frustrated because I cannot seem to figure out why Collections
I cannot seem to figure out I am getting the following error in IE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.