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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:30:05+00:00 2026-05-28T06:30:05+00:00

When a socket is signalled as being OK to write by a call to

  • 0

When a socket is signalled as being OK to write by a call to select(), how can I know how much data I can send without blocking? (In the case of full send buffers etc.)

Does inclusion in the set returned by select() signify that the socket is ready for at least one byte of data, and will send() then return a short count of written bytes?

Or will it block when I call send() with a len parameter that is bigger than the available buffer space? If so, how do I know the maximum amount?

I’m using regular C sockets on Linux.

  • 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-28T06:30:06+00:00Added an answer on May 28, 2026 at 6:30 am

    The send call should not block on the first call, and should send at least one byte on the first call — assuming you are using a stream protocol and assuming it’s not interrupted by a signal, etc. However, there are really only two ways to figure out how much data you can send:

    1. Call select after every call to send to see if more data can be sent.

    2. Put the socket in non-blocking mode, and call send until it gives an EAGAIN or EWOULDBLOCK error.

    The second option is preferred. (The third option is to do it in a different thread and simply let the thread block, which is also a good solution. In the past, threading implementations weren’t as mature so non-blocking mode was seen as necessary for high-performance servers.)

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

Sidebar

Related Questions

For a TCP blocking socket, is it safe to call: if(SOCKET_ERROR != recv(s, NULL,
Will Socket.SendAsync always send all data in the byte[] buffer that the SocketAsyncEventArgs has
Using socket programming APIs (e.g., socket(), connect(), accept() ...), how can I know if
Can socket send / recv set errno 27 (EFBIG) on Solaris? Under which condition
Can a Client pushing data through a UNIX domain socket ( AF_UNIX type )
When I call socket.getsockname() on a socket object, it returns a tuple of my
There is a socket related function call in my code, that function is from
I have the DWORD socket in windows. I need to know if it is
Using socket connections, how can I stream the screen view from one computer to
The socket.io documentation mentions that heartbeats can be disabled like so: io.disable('heartbeats'); Unfortunately, while

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.