I wrote a program that communicates using the serial port using MFC. For some reason, sometimes it works fine, but other times, it doesn't. Oddly enough, for those times that it doesn't connect, if I open a connection using hyperterminal, then close it, then try again with my program, then it works fine. Does anyone have a clue what I'm doing wrong?

Thanks beforehand