Click here to Skip to main content
15,920,828 members
Home / Discussions / C#
   

C#

 
Questionset control location on runtime Pin
Ajay R Ojha1-Nov-06 17:40
Ajay R Ojha1-Nov-06 17:40 
AnswerRe: set control location on runtime Pin
stancrm1-Nov-06 20:40
stancrm1-Nov-06 20:40 
AnswerRe: set control location on runtime Pin
quiteSmart1-Nov-06 20:47
quiteSmart1-Nov-06 20:47 
AnswerRe: set control location on runtime Pin
[Marc]2-Nov-06 1:12
[Marc]2-Nov-06 1:12 
QuestionINVALID LENGTH FOR BASE-64 CHAR ERROR Pin
nani.msn1-Nov-06 17:15
nani.msn1-Nov-06 17:15 
QuestionHELP - Programming Problem Pin
BooValu21-Nov-06 13:53
BooValu21-Nov-06 13:53 
AnswerRe: HELP - Programming Problem Pin
Matt Gerrans1-Nov-06 15:41
Matt Gerrans1-Nov-06 15:41 
QuestionAsynch Socket read seems to ignore my lock() Pin
liRetro1-Nov-06 13:21
liRetro1-Nov-06 13:21 
I have a little asynch. socket listener that notifies me when data is read. inside of the OnRead callback event it seems that my notifications were overlaping (future notifications triggered before past notifications 1.2.3.4.5. becomes 1.2.5.3.4.). The code goes like this:

private void OnReadComplete( IAsyncResult ar )
{
... copy the m_byBuffer data into byOut ...
... do some work ...

lock(m_ReadLockObject) <-- should block the next read attempt.
{
	// Continue reading
	if (m_netStream.CanRead && (m_Socket.Connected || m_netStream.DataAvailable))
		m_netStream.BeginRead(m_byBuffer, 0, m_byBuffer.Length, m_callbackRead, null);

	// Trigger Read Data event.
	if (bytesRead > 0)
		ExecOnDataRead(this, new CClientInfoEventArgs(m_EndPoint, byOut));
}
...
}


The data keeps comming in all jumbled up. Now I can patch this by putting in a sufficiently large delay, like a trace before and after I call ExecOnDataRead to check the current thread ID, OR I can re-arrange the ExecOnDataRead before the BeginRead. The thing is that I know ExecOnDataRead can be quite expensive and I do perform some work before I pass the data on, so I want the next BeginRead to be running while I'm doing that.

Note that a simple trace or debug seems to straighten out the data (obviously time sensitive) so I can't observe what is happening except through the end results. Even putting in a second lock inside ExecOnDataRead, or a static mutex.WaitOne() does not seem to straighten out the data, but as soon as I put in a Trace to print out the thread ID's that are running the ExecOnDataRead to see if they are overlapping, everything straightens out!! Ahrrgg! It's almost like the lock is not locking.Sigh | :sigh:

Thanks in advance

Assert(this);

QuestionGIS TRACKING SYSTEM Pin
Boshkash1-Nov-06 13:06
Boshkash1-Nov-06 13:06 
QuestionToolstrip text not showing update Pin
c-a-b-1-Nov-06 11:44
c-a-b-1-Nov-06 11:44 
AnswerRe: Toolstrip text not showing update Pin
Guffa1-Nov-06 13:21
Guffa1-Nov-06 13:21 
GeneralRe: Toolstrip text not showing update Pin
c-a-b-1-Nov-06 14:47
c-a-b-1-Nov-06 14:47 
AnswerRe: Toolstrip text not showing update Pin
Martin#1-Nov-06 20:26
Martin#1-Nov-06 20:26 
GeneralRe: Toolstrip text not showing update Pin
c-a-b-2-Nov-06 3:12
c-a-b-2-Nov-06 3:12 
QuestionDate Format dd/mm/yyyy in mysql Pin
fahiemulleh1-Nov-06 9:17
fahiemulleh1-Nov-06 9:17 
AnswerRe: Date Format dd/mm/yyyy in mysql Pin
led mike1-Nov-06 9:37
led mike1-Nov-06 9:37 
GeneralRe: Date Format dd/mm/yyyy in mysql Pin
fahiemulleh1-Nov-06 9:42
fahiemulleh1-Nov-06 9:42 
GeneralRe: Date Format dd/mm/yyyy in mysql Pin
led mike1-Nov-06 9:58
led mike1-Nov-06 9:58 
AnswerRe: Date Format dd/mm/yyyy in mysql Pin
Rob Graham1-Nov-06 9:39
Rob Graham1-Nov-06 9:39 
Questionhow to show/hide forms ? Pin
Ashraf zia1-Nov-06 8:59
Ashraf zia1-Nov-06 8:59 
AnswerRe: how to show/hide forms ? Pin
Pete O'Hanlon1-Nov-06 9:41
mvePete O'Hanlon1-Nov-06 9:41 
AnswerRe: how to show/hide forms ? Pin
Rahithi1-Nov-06 10:44
Rahithi1-Nov-06 10:44 
GeneralRe: how to show/hide forms ? Pin
Ashraf zia1-Nov-06 15:34
Ashraf zia1-Nov-06 15:34 
GeneralRe: how to show/hide forms ? Pin
Rahithi2-Nov-06 4:08
Rahithi2-Nov-06 4:08 
AnswerRe: how to show/hide forms ? Pin
Haseeb Mukhtar1-Nov-06 19:15
Haseeb Mukhtar1-Nov-06 19:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.