c - Bad File descriptor error due to socket reconnection -
actually trying identify problem, can close(sockfd) socket more once generate exception in file reading within same process.
here stuff creating problem :
have 2 threads :
- one thread responsible create connection server. retry make connection server in sleep of 10 secs if not connected.
- second thread reads 2 files , process both. , waits connection established other thread first time.
what have done, first thread connected server , goes down after that, main thread processes first file correctly fails read second file each time. if connection made other thread server persistent, both files processed successfully.
i want know reason behind this.
call close(sockfd) affecting file descriptor of second file??
Comments
Post a Comment