J
juanpolotto
Hi.
I'm write a "passthru" application which is reading from one socket
and writing to a pool of outcoming sockets. From time to time I have
date duplicated in the socket and when I debug the function below,
using step by step, I find that printf("LINE 1\n"); executes more than
once every time I hit F10 (Visual C++). I never saw something like
that.
Very weird!!!!!!!!!!!
unsigned __stdcall inWriteIncomingSocket(void* data) {
cMySocket *IncomingSocket;
cMySocket *OneSocket;
unsigned char chTCPBuffer[1024];
unsigned int uiTCPBufferSize;
int inResult;
int i, j;
inWriteToLog("inWriteIncomingSocket", FOREGROUND_RED +
FOREGROUND_BLUE);
IncomingSocket = (cMySocket *)data;
while(1) {
Sleep(SLEEP_TIME2);
inResult = IncomingSocket->hGetSocketHandler();
if(inResult<=0) continue;
//printf("ESCRIBIENDO A INCOMING SOCKET\n");
for(i=0; i<inSocketsPoolSize; i++) {
Sleep(SLEEP_TIME1);
OneSocket = SocketsPool;
if(!OneSocket) continue;
if(OneSocket-
//printf("PTVC->NAC (SIZE=
%d)--------------------------------------------------\n",
uiTCPBufferSize);
printf("LINE 1\n");
printf("LINE 2\n");
for(j=0; j<uiTCPBufferSize; j++) {
printf("%02X ", chTCPBuffer[j]);
}
printf("\n\n");
if(!IncomingSocket->bSend(chTCPBuffer, uiTCPBufferSize)) {
OneSocket->vdForceDisconnect();
}
}
OneSocket->uiCurrentState = SOCKET_STATE_SENDING_RECEIVING;
//IncomingSocket->bSend();
}
}
}
}
I'm write a "passthru" application which is reading from one socket
and writing to a pool of outcoming sockets. From time to time I have
date duplicated in the socket and when I debug the function below,
using step by step, I find that printf("LINE 1\n"); executes more than
once every time I hit F10 (Visual C++). I never saw something like
that.
Very weird!!!!!!!!!!!
unsigned __stdcall inWriteIncomingSocket(void* data) {
cMySocket *IncomingSocket;
cMySocket *OneSocket;
unsigned char chTCPBuffer[1024];
unsigned int uiTCPBufferSize;
int inResult;
int i, j;
inWriteToLog("inWriteIncomingSocket", FOREGROUND_RED +
FOREGROUND_BLUE);
IncomingSocket = (cMySocket *)data;
while(1) {
Sleep(SLEEP_TIME2);
inResult = IncomingSocket->hGetSocketHandler();
if(inResult<=0) continue;
//printf("ESCRIBIENDO A INCOMING SOCKET\n");
for(i=0; i<inSocketsPoolSize; i++) {
Sleep(SLEEP_TIME1);
OneSocket = SocketsPool;
if(!OneSocket) continue;
if(OneSocket-
if(OneSocket->bGetTCPBuffer(chTCPBuffer, &uiTCPBufferSize)) {uiCurrentState==SOCKET_STATE_DATA_FOR_CLIENT_AVAILABLE) {
//printf("PTVC->NAC (SIZE=
%d)--------------------------------------------------\n",
uiTCPBufferSize);
printf("LINE 1\n");
printf("LINE 2\n");
for(j=0; j<uiTCPBufferSize; j++) {
printf("%02X ", chTCPBuffer[j]);
}
printf("\n\n");
if(!IncomingSocket->bSend(chTCPBuffer, uiTCPBufferSize)) {
OneSocket->vdForceDisconnect();
}
}
OneSocket->uiCurrentState = SOCKET_STATE_SENDING_RECEIVING;
//IncomingSocket->bSend();
}
}
}
}