Ok I have been coding a bot, and I recently made some changes to the source, and I screwed it royally.
It was working fine !!

The code is thread-based, using WSAWaitForMultipleObjects on a single eventobject comprised of FD_CONNECT,FD_READ and FD_CLOSE.

I wait for a socket event, then call WSAEnumSocketEvents to determine which event(s) have fired.

Then I simply handle the events using an if else endif loop.

All straightforward, just one socket, nice and easy.
Until I added some code to the FD_READ handler, and now this is what is happening:
I connect , and from inside the connect handler I send the first data, a login. I then jump back, waiting on the next event.
Next I get some data from the server, which I RECV and parse, and I find my login is fine, so I go to send my second datapacket.
This packet never gets sent, but no WSA error is generated by the SEND.. since I saw no error I jump back to the Wait function again, to await the reply....
here the event wait fails immediately with the error# 998
which I found out is ERROR_NOACCESS, 998 Invalid access to memory location.
Ok the problem I have with that is that the data I am trying to send is in both cases located in the global data segment owned by the Parent of the thread, the main application window !!
(ie under .DATA)
Why does it work the first time and not the second time?
I have not changed the permissions I create the thread with , which is NULL (Inherit from Parent), and same for the thread stack size again NULL (Inherit from Parent).
Posted on 2002-03-04 23:34:41 by Homer

I am on an XP box, using the old ML.EXE (Masm7)

I fixed the problem by changing the instructionset from .386 to .486 in the thread's parent (thread is an INCLUDE)
I am left to conclude that the problem was created by a compiler bug, as the permissions should be ok.
The problem occured when I accessed a dword variable located in the .DATA segment of the Parent from the Child Thread's FD_READ handler.
I look forward to getting my grubby paws on the updated ML.EXE which apparently exists in the new XP DDK.
Posted on 2002-03-05 08:49:48 by Homer
The last version of ml.exe is in MS VisualEntArch.NET -> 7.00.9466
Posted on 2002-03-05 11:08:30 by buliaNaza
Would / Could someone post an URL to the updated ML.exe?

Thanks, P1
Posted on 2002-03-06 08:35:56 by Pone