473,803 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReadFile problem(VC++)

friendjin
19 New Member
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;  
  10.  
  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?
Thanks.
Feb 23 '07 #1
0 1583

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

Similar topics

0
1536
by: Moi | last post by:
Hello, sorry if this has been asked over & over, in which case, please someone points me to the answer :) My situation: I've an ActiveX witten in VC++6, it has several methods returning a VT_RECORD struct in Variant, as well as arrays of struct.
2
4061
by: Armando | last post by:
i write one programm in vc++ but the compiler say that i use ambiguous symbol,i don´t know why ? how can do to tell the compiler that is ok so ? i become this error message: error C2872: 'ifstream' : ambiguous symbol error C2872: 'ofstream' : ambiguous symbol error C2065: 'fileread' : undeclared identifier error C2228: left of '.open' must have class/struct/union type error C2228: left of '.eof' must have class/struct/union type
6
3205
by: Armando | last post by:
Hallo ! I habe some error in my programm,because i use <fstream.h>,I want to use <fstream> but i don´t know which fonctions i must modify in my program ? Thanks you for your help. Armando.
11
1922
by: Tatu Portin | last post by:
Have this kind of struct: typedef struct { char **user_comments; /* ... */ } vorbis_comment; /* prototype */ char * read_vorbis_string ( FILE *sc);
0
1282
by: Domingos Jr. | last post by:
Hello, I have a VC++ dialog that contains other child dialogs, and one of these child dialogs have checkboxes inside. When I'm using windows xp with some theme, the checkbox display only the box, the region of the text is filled by a black rectangle. The same thing happens with radio buttons if I set Transparent = True, otherwise it displays the text with an opaque background. Does anybody knows how to solve this?
8
1021
by: MatthiasBiel | last post by:
Hi all, Microsoft Visual C++ .NET 69586-112-0293626-18840 doesn't compile the code below, it issues a C2146. template<class T> class A { public: typedef T X; };
0
1021
by: Usman | last post by:
Hi there I'm having problem compiling my code. I have a library along with its header file that I've used in my Com project. On compilation I get this linking error. Does anyone have any idea how to remove these linker errors. The problem comes only when I use a class (exists in library) variable in my Com code. TestAPP error LNK2019: unresolved external symbol _crc32 referenced in function "public: unsigned long __thiscall...
0
1981
friendjin
by: friendjin | last post by:
VC++.NET I am going to read some response from serialport after I write some into serial port(serial port connected to the Modem). Now, when I connect, the code is working well. the problem is: once I disconnect the modem, the process will be dead, the reason is ReadFile command can not get the response from the modem. But I do not know how it can exist if there is no response. thanks
1
2618
by: Derek =?utf-8?Q?Kuli=C5=84ski?= / takeda | last post by:
I spent many hours on this, googling around and experimenting, and still nothing. I wrote an umanaged program (actually various classes), while I was developing them I used command line to test it. Now, I decided to make GUI for it, so I created new project: "Windows Forms Application (.NET)" (I was trying to use something that's not managed (e.g. MFC, but I learned quickly that I don't actually know how to use MFC :) In .NET I was able...
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9565
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2972
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.