Buenas, resulta que tengo una palicacion en C++ que se comunica por medio del
puerto serial, en el cual envio valores enteros, pero resulta que si por
algun motivo el otro equipono me contesta el programa se queda esperando la
respuesta, aqui les mando el codigo con el que creo el manejador
HANDLE open_port(char puerto[]){
DCB dcb;
// Open serial port as a file
HANDLE handle;
handle = CreateFile("COM1:",
GENERIC_READ | GENERIC_WRITE,
0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
// FILE_FLAG_OVERLAPPED
if (handle == INVALID_HANDLE_VALUE) {
// printf("Couldn't open serial device!");
return NULL;
}
// Get current communication state
GetCommState(handle, &dcb);
// Turn off hardware handshake
dcb.BaudRate = 9600;
// dcb.fParity = FALSE;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
dcb.ByteSize = 8;
// dcb.fBinary = true;
// dcb.fOutxCtsFlow = TRUE;
// dcb.fOutxDsrFlow = TRUE;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;
// dcb.XonLim = 0;
// dcb.XoffLim = 0;
// Set communication state
SetCommState(handle, &dcb);
// printf("Puot %d enable",handle);
return handle;
}
Gracias por su ayuda
Leer las respuestas