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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:47:37+00:00 2026-05-11T05:47:37+00:00

From one thread I got the following code: int next_stuff(char **code){ … len=read(file_desc,buffer+end_len,packet_size-end_len); if(len<=0)

  • 0

From one thread I got the following code:

int next_stuff(char **code){     ...            len=read(file_desc,buffer+end_len,packet_size-end_len);     if(len<=0)     {         if(len==-1 && errno==EAGAIN) return(0);         else return(-1);     }     ... }  while (next_stuff(&buff) == 0) {     ... } 

On the other thread I’d like to finish that socket and exit this operation, but only doing a

close(file_desc); 

does not cause read to return nonblocked. Am I missing something?

EDIT:

shutdown does not work as well. And I am trying that on Linux 2.6.23

  • 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. 2026-05-11T05:47:37+00:00Added an answer on May 11, 2026 at 5:47 am

    shutdown(fd, SHUT_RD);

    $ man -s 2 shutdown

    NAME shutdown — shut down part of a full-duplex connection

    SYNOPSIS

     #include <sys/socket.h>   int     shutdown(int socket, int how); 

    DESCRIPTION

     The shutdown() call causes all or part of a full-duplex connection on the socket   associated with socket to be shut down.    If how is SHUT_RD, further receives will be disallowed.  If how is   SHUT_WR, further sends will be  disallowed.  If how is SHUT_RDWR, further sends and receives will be disallowed. 

    RETURN VALUES

     The shutdown() function returns the value 0 if successful; otherwise the value -1 is   returned and the global variable errno is set to indicate the error. 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following from this thread: Another IE jQuery AJAX/post problem (please read the thread to
Are there any concurrency problems with one thread reading from one index of an
I have a server that receives various xml messages from clients (one thread per
Follow up question from Multi-core usage, threads, thread-pools . Are threads moved from one
I'm not able to start activity from thread. I want to start one activity
Following code is only to show how to use condition variable to synchronize threads(one
Following on from a discussion which got going in the comments of this question
I got DateTimePicker control. I used the following code to set the format of
So the following code is possible in C# to start a new thread in
I have two threads, one reading streams and producing data-objects from their content. I

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.