By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,388 Members | 1,839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,388 IT Pros & Developers. It's quick & easy.

ReadFile problem(VC++)

P: 19
Expand|Select|Wrap|Line Numbers
  1. WriteFile(hCom1, "AT+CSQ\r", sizeof("AT+CSQ\r"), &dwWritten, &ovlw);
  2.     Sleep(50);
  3.                 COMMTIMEOUTS comto;  
  4.     comto.ReadIntervalTimeout = 10;  
  5.       comto.ReadTotalTimeoutMultiplier = 5000;  
  6.                 comto.ReadTotalTimeoutConstant = 0; //dwTimeoutMs;  
  7.                 comto.ReadTotalTimeoutMultiplier = 0;  
  8.       comto.WriteTotalTimeoutConstant = 5000;  
  9.       comto.WriteTotalTimeoutMultiplier = 0;  
  11.     f(!SetCommTimeouts(hCom1, &comto))
  12.     {
  13.     fprintf(Err, "%s\n", "Fail to get the response from the modem.");
  14.     goto end;
  15.     }
  16.     int ReadError;
  17.     ReadFile (hCom1, &szBuffer, sizeof(szBuffer), &dwRead, &ovlr);
This is part of code, the problem is while the modem is connectting, it is working all right.but while the modem is not connect well, or other problem form the modem, the programe will be stopped on the ReadFile().I mean the programe could not be stopped untill getting the response but actually no response in this case as modem error.I tried to set a timeout to exist while this error happens, but it would not work. I don't know what the problem is.
Any idea?
Feb 23 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.