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 8236183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:04:01+00:00 2026-06-07T19:04:01+00:00

I’m trying to automate a server request to the client upon connection but I

  • 0

I’m trying to automate a server request to the client upon connection but I keep getting the WSAGetLastError of 10057. I’ve set up requests from the client to the server without issues so I don’t understand why I cant do the reverse ? Maybe the server must wait for the 1st ‘send’ from the client but I don’t understand why that could be so ?

I’m using:
-asynchronous socket
-TCP
-s is a valid socket
-i’v looped RequestInfo for several passes but nothing changes
-select() returns 0
-datasize returns -1 with errcode 10057

THANK YOU !!!

SERVER:

//first - following the debugger  
FD_ACCEPT  
int acc = accept(s, (struct sockaddr*)&fromm, &fromlenn);  //success
if(acc <= 0)  
{  
    eLOGG << "\nFAIL FD_ACCEPT: " << WSAGetLastError();  
}  
RequestInfo();   

//then
RequestInfo()
{
    stringstream ssConverter;
    ssConverter.clear();    ssConverter.str(string());
    ssConverter << "00aa";      //request signal

    bool blogin = false;

    eLOG << "signal is: *" << ssConverter.str() << "*";

    int bufSize = ssConverter.str().length();

    fd_set writefds;

    struct timeval timeout;
    timeout.tv_sec = 3;
    timeout.tv_usec = 0;

    FD_ZERO(&writefds);
    FD_SET(s, &writefds);

    int sel = select(s, NULL, &writefds, NULL, &timeout);
    if(sel == SOCKET_ERROR) 
    {
        eLOG << "\nselect - read fail: " << WSAGetLastError();
    }
    if(sel == 0)
    {
        eLOG << "\nselect - not connected: " << WSAGetLastError();
    }

    if (FD_ISSET(s, &writefds))
    {
        eLOG << "\n FD_ISSET";
    }
    eLOG << "\nauth socket is: " << s;
    int dataSize = send(s, ssConverter.str().c_str(), bufSize, 0);
    if(dataSize < bufSize)  
    {
        eLOG << "\n FD_ISSET";
    }
    //...etc
}
  • 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-06-07T19:04:04+00:00Added an answer on June 7, 2026 at 7:04 pm

    You are confusing the listening server socket s and the connected socket, which you get from accept() in the acc variable. You cannot send or receive data over the server socket since it’s not connected to anything. Its only purpose is to accept new connections from clients. After all, servers usually handle multiple clients.

    By the way, that connected socket does not inherit non-blocking status from the server socket, so you need to mark it so after every accept().

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.