Weird situation with WinSock
-
Alright, I've ran into a problem that I'm really confused over: I'm writing a simple mail client. It runs fine on my computer (Windows XP, SP2). However, when ran on a Vista machine, it crashes. Not as in BSOD-crash, it's more like the whole system just freezes over. A friend of mine, who was testing it on her vista machine, she says that everything just freezes (including the mouse) and the few times she had music on, *the last few times *i had musci on *but not this time *and it like.. *Stutters *in that spot I managed to trace it down to here:
MessageBox(NULL,"got here 1","okay",MB\_OK); closesocket(hSocket); hSocket = NULL; MessageBox(NULL,"got here 3","okay",MB\_OK);
The first msgbox shows, but the second doesn't. (friend of mine isn't exactly computer-savvy, so I put the messageboxs in there so she could test the app). I'm really stumped by this, because it works fine on XP. What does Vista change that doesn't allow the proper disconnection and closing of a socket? If it changes anything, this is all happening in a seperate thread, started by a call to
AfxBeginThread
inside aWH_KEYBOARD_LL
callback function. But that shouldn't make a difference, should it? If any more info is needed, just ask. It's a rather large piece of code, so it's hard for me to describe everything that's going on. Thanks in advance. :) -
Alright, I've ran into a problem that I'm really confused over: I'm writing a simple mail client. It runs fine on my computer (Windows XP, SP2). However, when ran on a Vista machine, it crashes. Not as in BSOD-crash, it's more like the whole system just freezes over. A friend of mine, who was testing it on her vista machine, she says that everything just freezes (including the mouse) and the few times she had music on, *the last few times *i had musci on *but not this time *and it like.. *Stutters *in that spot I managed to trace it down to here:
MessageBox(NULL,"got here 1","okay",MB\_OK); closesocket(hSocket); hSocket = NULL; MessageBox(NULL,"got here 3","okay",MB\_OK);
The first msgbox shows, but the second doesn't. (friend of mine isn't exactly computer-savvy, so I put the messageboxs in there so she could test the app). I'm really stumped by this, because it works fine on XP. What does Vista change that doesn't allow the proper disconnection and closing of a socket? If it changes anything, this is all happening in a seperate thread, started by a call to
AfxBeginThread
inside aWH_KEYBOARD_LL
callback function. But that shouldn't make a difference, should it? If any more info is needed, just ask. It's a rather large piece of code, so it's hard for me to describe everything that's going on. Thanks in advance. :)Did you try it on more than one Vista machines? Does it crash at the same spot on every vista computers? You mentioned that it is happeneding in a separate thread, so, could it be a synchronization error? I mean, synchronization errors tend to be different depending on a lot of things, for example we had such error(s) that would never pop up on a single core muchine but they would happen almost every time on dual core systems, also they can depend on timings, for example you could have such an error that doesn't pop up at first but if you run winamp and start playing your favourite music then it does because if the computer has more things to do then your process/threads get less CPU time and then somethings that before did not happen simulteniously before will happen now and cause the problem... Also, are you sure your hSocket is valid?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
-
Did you try it on more than one Vista machines? Does it crash at the same spot on every vista computers? You mentioned that it is happeneding in a separate thread, so, could it be a synchronization error? I mean, synchronization errors tend to be different depending on a lot of things, for example we had such error(s) that would never pop up on a single core muchine but they would happen almost every time on dual core systems, also they can depend on timings, for example you could have such an error that doesn't pop up at first but if you run winamp and start playing your favourite music then it does because if the computer has more things to do then your process/threads get less CPU time and then somethings that before did not happen simulteniously before will happen now and cause the problem... Also, are you sure your hSocket is valid?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
Again, sorry for the vagueness. No, I haven't tried it on more than 1 Vista machines, and I doubt it's a synchronization error. All the thread does is create an email header and sends it, while the main thread is open for the UI. Aside from the 4 variables passed to the thread at the start, the thread doesn't even use any of the variables used in the main thread. Yes, I'm sure my hSocket is valid, as I seem to be able to send emails using it. I'm going to try it on some more vista machines today, thanks for the suggestion. :)
-
Alright, I've ran into a problem that I'm really confused over: I'm writing a simple mail client. It runs fine on my computer (Windows XP, SP2). However, when ran on a Vista machine, it crashes. Not as in BSOD-crash, it's more like the whole system just freezes over. A friend of mine, who was testing it on her vista machine, she says that everything just freezes (including the mouse) and the few times she had music on, *the last few times *i had musci on *but not this time *and it like.. *Stutters *in that spot I managed to trace it down to here:
MessageBox(NULL,"got here 1","okay",MB\_OK); closesocket(hSocket); hSocket = NULL; MessageBox(NULL,"got here 3","okay",MB\_OK);
The first msgbox shows, but the second doesn't. (friend of mine isn't exactly computer-savvy, so I put the messageboxs in there so she could test the app). I'm really stumped by this, because it works fine on XP. What does Vista change that doesn't allow the proper disconnection and closing of a socket? If it changes anything, this is all happening in a seperate thread, started by a call to
AfxBeginThread
inside aWH_KEYBOARD_LL
callback function. But that shouldn't make a difference, should it? If any more info is needed, just ask. It's a rather large piece of code, so it's hard for me to describe everything that's going on. Thanks in advance. :)hxhl95 wrote:
If it changes anything, this is all happening in a seperate thread, started by a call to AfxBeginThread inside a WH_KEYBOARD_LL callback function. But that shouldn't make a difference, should it?
Introducing multiple threads will always make a difference. Race conditions, sharing of resources, deadlocks, and context switches are just some of the things that come into play above and beyond the normal stuff.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons