HI
 
Ok, I know what the second problem is, it seems that the packet complete right after you close the socket making the callback get called again, I guess I just need a way to keep track of this last event.
 
I have found one more thing though....  The server seems to receive/send the packet server times in succession and I'm not sure why.....  Something for me to look in to I guess.
 
Regards
Max
 
 
 
 
 
----- Original Message -----
From: Max
Sent: Sunday, March 28, 2004 3:50 PM
Subject: Re: [msvc] IOCP

HI
 
Right I've fix the first problem.  What I was doing is in the callback I had freed some memory (dropping a connection) but did not check the pointer which I had then used later on to try and read data off the network.  This didn't crash ( never does when you want it to )  but it did create a first chance exception.  The problem, really showed itself when I tried to allocate more memory - the debugger showed that the listening thread memory allocation was going wrong.
 
Second problem.
 
I'm getting a first chance exception while getting the time.  Each connection object has a has a function to get the time so I can see when the last read/write operation tool place and then decide whether to drop the connection later on or not.  Now under certain conditions the server should drop the connection such as someone logging on with the wrong ID. 
 
To do this the server send a Error code to the user and then disconnects - closing the socket, freeing memory etc.  However the Callback gets called again but the Parameters hold information that's not valid.
 
Regards
Max
 
 
----- Original Message -----
Sent: Sunday, March 28, 2004 11:40 AM
Subject: RE: [msvc] IOCP

 
I have an IOCP server that works (or seems to) when run normally in both debug and release types.  It does throw an exception when run through the debugger while trying to allocate memory.  The call stack shows only seems to show NTDLL.
 
 
The sequence of events leading to the exception are when a socket is being created for the second time.  So it goes something like
 
Listen for a Connection
Get hSocket stick it in a list
BindIOCallback with the socket
 
work with socket
 
Close socket remove it from list
 
 
 
 
Then when going around this sort of loop for the second time (another connection) the sever throws an exception.  Has anyone else come across this??
Configure your server to halt on first chance notifications, and you'll break into the debugger as soon as the exception is generated.  Then, you can inspect the instruction which raises the exception, and can get more information on why it's happenning.

---------
Ehsan Akhgari

www.farda-tech.com
List Owner: [EMAIL PROTECTED]

[Email: [EMAIL PROTECTED]]
[WWW:
http://www.beginthread.com/Ehsan ]
 


_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.


_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.

Reply via email to