Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualDvDmanDT

Posted 29 May 2012 - 09:55 PM

Is HandleMessage() and OnMessageRecieved() the same? If not, what does HandleMessage() look like? And what's Message.HeaderSize?

Edit: Are zero-length arrays even legal?
Edit2: Apparently they are. I suppose it makes sense for some situations.


Edit3: In other comments, you should probably stop spawning new threads for each recieved message, that's going to be pretty inefficient and probably resource intensive. Can't you use ThreadPool or something instead?

Edit4: The thread might be the problem. I'm always confused about anonymous functions accessing variables from outer scope. Your problem is possibly that it takes a while to start the thread, so before the delegate is called, the value of the message variable in the outer scope has changed.

#4DvDmanDT

Posted 29 May 2012 - 09:52 PM

Is HandleMessage() and OnMessageRecieved() the same? If not, what does HandleMessage() look like? And what's Message.HeaderSize?

Edit: Are zero-length arrays even legal?
Edit2: Apparently they are. I suppose it makes sense for some situations.


Edit3: In other comments, you should probably stop spawning new threads for each recieved message, that's going to be pretty inefficient and probably resource intensive. Can't you use ThreadPool or something instead?

#3DvDmanDT

Posted 29 May 2012 - 09:48 PM

Is HandleMessage() and OnMessageRecieved() the same? If not, what does HandleMessage() look like? And what's Message.HeaderSize?

Edit: Are zero-length arrays even legal?
Edit2: Apparently they are. I suppose it makes sense for some situations.

#2DvDmanDT

Posted 29 May 2012 - 09:47 PM

Is HandleMessage() and OnMessageRecieved() the same? If not, what does HandleMessage() look like? And what's Message.HeaderSize?

Edit: Are zero-length arrays even legal?

#1DvDmanDT

Posted 29 May 2012 - 09:47 PM

Is HandleMessage() and OnMessageRecieved() the same? If not, what does HandleMessage() look like? And what's Message.HeaderSize?

PARTNERS