Bad File Descriptor Error In Linux
Contents |
here for a quick overview of the site Help Center Detailed answers to bad file descriptor socket any questions you might have Meta Discuss the workings and
Bad File Descriptor C
policies of this site About Us Learn more about Stack Overflow the company Business Learn
What Is Bad File Descriptor
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow
Bad File Descriptor Error In C
Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Bad File Descriptor with Linux Socket write() Bad File Descriptor C up vote -1 down vote favorite I have an interesting problem with write(2) function. PrepareResponseForSetCoordinates what does bad file descriptor mean function causes bad file descriptor error on write. Here is the line of error: perror("ERROR writing to socket"); total output: ERROR writing to socket: Bad file descriptor I am sure that I have established the connection because PrepareResponseForConnectionTest works like a charm. Can you have any idea about the reason of the error? When I use gcc as compiler there was no problem. After that because of using multiple new cpp sources I am using g++ as compiler and I have this error. Regards Here below my code: #define MAX_PMS_MESSAGE_LEN (4096) unsigned char baCommBuffer[MAX_PMS_MESSAGE_LEN]; unsigned char PrepareResponseForSetCoordinates(void) { unsigned char baTempBuff[255]={0}; unsigned short bCnt=0,i=0,bCsum=0,bCnt2=0; time_t lEpochTime; time_t lSessionTime; memset(baTempBuff,0,sizeof(baTempBuff)); memset(baCommBuffer,0,sizeof(baCommBuffer)); bzero(baCommBuffer,MAX_PMS_MESSAGE_LEN); bzero(baTempBuff,sizeof(baTempBuff)); lEpochTime = time(NULL); baCommBuffer[bCnt++] = START_CHAR; baCommBuffer[bCnt++] = START_CHAR; baCommBuffer[bCnt++] = PACKET_SEPERATOR; sprintf((char*)baTempBuff,"%ld",(unsigned long)lEpochTime); memcpy(baCommBuffer+bCnt,baTempBuff,10); bzero(baTempBuff,sizeof(baTempBuff)); bCnt+=10; baCommBuffer[bCnt++] = PACKET_SEPERATOR; // lSessionTime = time(NULL); if(SPMSMessage.lSessionID) lSessionTime = SPMSMessage.lSessionID; else lSessionTime=lEpochTime; sprintf((char*)baTempBuff,"%ld",(unsigned long)lSessionTime); memcpy(baCommBuffer+bCnt,baTempBuff,10); bzero(baTempBuff,sizeof(baTempBuff)); bCnt+=10; baCommBuffer[bCnt++] = PACKET_SEPERATOR;
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the bad file descriptor shell script company Business Learn more about hiring developers or posting ads with us Unix & Linux bad file descriptor vlc Questions Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, bad file descriptor bash FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the http://stackoverflow.com/questions/11258781/bad-file-descriptor-with-linux-socket-write-bad-file-descriptor-c top strange “bad file descriptor” error up vote 2 down vote favorite I've run into a perplexing error that I'd like to understand better. The problem seems to require the presence of a "wrapper" shell function (as described below), so my immediate interest is to find out how to modify such a shell function to get rid of the error. (I give a more specific statement of my question at the end of the post.) http://unix.stackexchange.com/questions/87630/strange-bad-file-descriptor-error The simplest code that I've come up with to reproduce this error is given in the following script. (This script is certainly artificial and silly, but the real-life situation in which the error first surfaced is a bit too complicated for a demonstration like this one.) # create an input file cat <
Svenska עברית Sign In Go! Downloads Contact Sales Call sales: 1-800-691-1991 8am - 8pm ET Back Downloads Contact Sales solutionsProductsHow to https://www.veeam.com/kb1741 buyService ProvidersPartnersResourcesCompanySupport Business sizeEnterprise and Medium BusinessSmall BusinessVertical SegmentFederal Government (FED)State & Local Government/Education (SLED)CloudVeeam Cloud SolutionsDisaster Recovery-as-a-Service (DRaaS)Service ProviderVirtualization https://bbs.archlinux.org/viewtopic.php?id=185298 PlatformMicrosoftVMwareStorage and ServerNetAppHPECiscoEMC All Success StoriesAvailability for the Always-On EnterpriseVeeam Availability PlatformVirtual Workloads (VMware and Hyper-V)Veeam Availability Suitev9Veeam Backup & bad file Replication v9Veeam Availability ConsoleCloud and Physical WorkloadsVeeam Agent for Microsoft WindowsVeeam Agent for LinuxVeeam Availability ConsoleDisaster Recovery OrchestrationVeeam Availability OrchestratorSmall Business under 250 employeesVeeam Backup Essentialsv9Veeam vs. CompetitionCloud and Service ProvidersVCSP Program and Product OfferingsVeeam Availability ConsoleMonitoring and ManagementVeeam bad file descriptor ONEv9Veeam Management Pack for System CenterFree ToolsVeeam Backup Free EditionVeeam Endpoint Backup FREEVeeam ONE Free EditionVeeam FastSCP for Microsoft AzureOther Free ToolsAll Veeam Products Success StoriesHow to buyRenewalsSpecial OffersFindaResellerFind a Veeam Cloud & Service ProviderContact SalesJoin the Veeam Cloud & Service Provider ProgramProgram OverviewThe DRaaS OpportunityLaunch a Managed Backup ServiceCloud & Service Provider DirectoryFind a Veeam Cloud & Service ProviderCloud & Service Provider Success StoriesAlready a VCSP?Log in to VCSP PortalVCSP EnablementHow to buy Become a PartnerService ProviderResellerDistributorAlliance PartnerProPartner Success StoriesAlready a Partner?Log in to ProPartner PortalProPartner UniversityDeal Registration Technical DocumentationResource LibraryVeeamBlogExecutive BlogFREE Online Education(Veeam University)Veeam Community ForumsVeeamLiveExpert WebinarsProduct DemosWhite PapersCompanyManagement TeamvExperts at VeeamMVPs at VeeamVeeam VanguardsCareersNews RoomAwardsEventsContacts Customer Support PortalKnowledge BaseSupport PolicyLatest UpdatesPrevious VersionsTechnical DocumentationLicense Managemen
stefano Member Registered: 2011-04-09 Posts: 103 [SOLVED] Cups refuses to work: "bad file descriptor" I am not getting CUPS to work on a new installation.I need to use cups as a client printing to a printer attached to a separate server. What I did:1. I installed the cups package and started/enabled the service in systemd.2. The remote server has a working CUPS installation (accessible and working from other computers)3. I can see the remote printer listed among the printers in CUPS's local web interfaceHowever, every job sent to the printer (from the GUI: KDE based apps such as Okular, etcetera) silently fails.No job is ever listed on the CUPS web interface.If I try to check on CUPS status with lstat I get the following error:$> lpstat lpstat: bad file descriptorAny suggestion on how to fix the problem?Edit: more infoIt seems that cups is running fine according to systemd:[stefano@gorgias ~]$ systemctl status cups ● cups.service - CUPS Printing Service Loaded: loaded (/usr/lib/systemd/system/cups.service; enabled) Active: active (running) since Mon 2014-08-04 17:56:32 CDT; 16h ago Main PID: 2832 (cupsd) Status: "Scheduler is running..." CGroup: /system.slice/cups.service └─2832 /usr/bin/cupsd -f Aug 04 17:56:32 gorgias systemd[1]: Started CUPS Printing Service.but not so according to CUPS itself:[stefano@gorgias ~]$ lpstat -t scheduler is not running no system default destination lpstat: Bad file descriptor lpstat: Bad file descriptor lpstat: Bad file descriptor lpstat: Bad file descriptor lpstat: Bad file descriptorSo systemd tells me the scheduler is running, while CUPS claims it is not Last edited by stefano (2014-08-06 22:15:53) Offline #2 2014-08-06 22:24:54 stefano Member Registered: 2011-04-09 Posts: 103 Re: [SOLVED] Cups refuses to work: "bad file descriptor" It turns out the problem was with a misconfiguration in /etc/cups/client.confOr perhaps cups changed behavior between releases and the older client.conf on my system did not work any longer.For future reference, the problem was the following:in /etc/cups/clien