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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:02:38+00:00 2026-06-02T02:02:38+00:00

Here is a compiling extract of a program that uses glut and pthreads. With

  • 0

Here is a compiling extract of a program that uses glut and pthreads.

With nvidia driver version 295 the tcp accept interrupted when glutmainloop starts (the program reports error 4)

with version 275 the program works fine.

(ubuntu, 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux problem verified also with 3.0.0-16)

Including -lglut and -lpthread in either order does not fix the problem
if the glStuff function is not called, the program works as expected

did someone encounter similar problems?

#include <GL/glut.h>  
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <iostream>

using namespace std;


enum Error{WSASTARTUP,SOCKETCREATION,SOCKETBINDING,SOCKETLISTENING,SOCKETACCEPT};
void onError(Error err){
 std::cerr<<"error"<<err<<endl;
}


void* serverrun(void*){
 int mainSocket;
 int port=15002;
 struct sockaddr_in local;
 local.sin_family=AF_INET;
 local.sin_addr.s_addr=htonl(INADDR_ANY);
 local.sin_port=htons((u_short)port);
 mainSocket=socket(AF_INET,SOCK_STREAM,0);
 int val=1;
 setsockopt(mainSocket,SOL_SOCKET,SO_REUSEADDR,&val,sizeof(val));
 if(mainSocket<0){
  onError(SOCKETCREATION);  
}
if(bind(mainSocket, (struct sockaddr*)&local,sizeof(local))!=0)
{
  onError(SOCKETBINDING);
}
if(listen(mainSocket,10)!=0)
{
  onError(SOCKETLISTENING);
} 
struct sockaddr_in from;
socklen_t fromlen=sizeof(from);

while(true){
 int cs;
 cs=accept(mainSocket,(struct sockaddr*)&from,&fromlen);
 if (cs!=-1){
  std::cout<<"new client"<<std::endl;
 }else{
   onError(SOCKETACCEPT);
 }
}//while running
return NULL;
}//run

void drawGLScene(){}

void idleFunc(){}



void glStuff(int& argc,char** argv){
 glutInit(&argc, argv);  
 glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);    
 glutInitWindowSize(100,100);  
 glutInitWindowPosition(0,0);
 glutCreateWindow("win");
 glutDisplayFunc(drawGLScene);      
 glutIdleFunc(idleFunc);
 glutMainLoop();
}
  • 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-02T02:02:40+00:00Added an answer on June 2, 2026 at 2:02 am

    You seem to be completely ignoring errno, what is the exact error that you see?

    If it is EINTR, you should just retry, that’s perfectly normal.

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

Sidebar

Related Questions

I'm having problems compiling a CUDA program that uses GLUT on MacOsX. Here is
I'm getting errors while compiling a program that uses threads. Here is the part
I'm following the kernel tutorial from here im having problems compiling my files. i
Using the client and server examples found here: http://www.winsocketdotnetworkprogramming.com/winsock2programming/winsock2advancedmailslot14.html Compiling them with VS2008, running
Trying to build sslsniff on a RHEL 5.2 system here. When compiling sslsniff on
Okay, Here is what I'm trying to do... Right now it is compiling but
Here's the deal: I'm in the process of planning a mid-sized business application that
It's from here ,but fails when compiling: int main(int argc, char **argv) { struct
I get this error when compiling the following source from here : Error 1
I'm try to compiling the libpmk library http://people.csail.mit.edu/jjl/libpmk/#docs following the documentation here http://people.csail.mit.edu/jjl/libpmk/documentation/ .

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.