Printf Write Error Bad File Descriptor
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might bad file descriptor linux have Meta Discuss the workings and policies of this site About
Bad File Descriptor Socket
Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads what is bad file descriptor with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million
Bad File Descriptor C
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 function causes bad file descriptor error on write. Here is the line of error: bad file descriptor error in c 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; baCommBuffer[bCnt++] = PMC_ID; baCommBuffer[bCnt++] = PACKET_SEPERATOR; baCommBuffer[bCnt++] = PMS_ID; baCommBuffer[bCnt++] = PACKET_SEPERATOR; baCommBuffer[bCnt++] = 'R'; baCommBuffer[bCnt++] = 'E'; baCommBuffer[bCnt++] = 'P'; baCommBuffer[bCnt++] = PACKET_SEPERATOR; baCommBuffer[bCnt++] = 'C'; ba
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
Bad File Descriptor C Pipe
site About Us Learn more about Stack Overflow the company Business Learn
Bad File Descriptor Select
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x what does bad file descriptor mean Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up error http://stackoverflow.com/questions/11258781/bad-file-descriptor-with-linux-socket-write-bad-file-descriptor-c in pipe implementation , i am facing this error, ls: write error: Bad file descriptor up vote 0 down vote favorite I made this while implementing shell in c,but though while implementing pipes , i came up with this error ls:write error :Bad file descriptor ,and i am not understanding why this error is coming up, Please help. #include
PG P E B Consultant 3