Click here to Skip to main content
15,867,308 members
Home / Discussions / C#
   

C#

 
QuestionHow to Find the documentation oF MSPastry Library in MSDN? Pin
ksaw12318-Dec-09 0:24
ksaw12318-Dec-09 0:24 
AnswerRe: How to Find the documentation oF MSPastry Library in MSDN? Pin
Dave Kreskowiak18-Dec-09 4:10
mveDave Kreskowiak18-Dec-09 4:10 
QuestionThreading Question Pin
Harvey Saayman17-Dec-09 23:11
Harvey Saayman17-Dec-09 23:11 
AnswerRe: Threading Question Pin
#realJSOP17-Dec-09 23:40
mve#realJSOP17-Dec-09 23:40 
GeneralRe: Threading Question Pin
Harvey Saayman18-Dec-09 0:24
Harvey Saayman18-Dec-09 0:24 
AnswerRe: Threading Question Pin
Pete O'Hanlon18-Dec-09 0:14
subeditorPete O'Hanlon18-Dec-09 0:14 
GeneralRe: Threading Question Pin
Harvey Saayman18-Dec-09 2:32
Harvey Saayman18-Dec-09 2:32 
GeneralRe: Threading Question Pin
Luc Pattyn18-Dec-09 5:23
sitebuilderLuc Pattyn18-Dec-09 5:23 
Hi Harvey,

I haven't done massive TCP/IP on Windows yet, however I looked at your code and have two remarks:

1.
your PacketReceivedCallback() method is asynchronous to everything else in your app, so it is bound to run on a separate thread; earlier experiments like these[^] have convinced me they always run on a Thread from the one and only ThreadPool in .NET

Of course you could modify the scheme in such a way that PacketReceived() rather than processing the packet, just puts it in some queue, then signals its waiter, which could be another Thread, a regular one, a ThreadPool one, or one from any other fancy threadpool you choose. That could be advantageous when your machine has several processors, and I mean more than 2 here. On a 1- or 2-core machine it probably isn't worth the trouble.

2.
Your code is silently converting incoming bytes into chars into strings. That may be fine, however in general TCP/IP transports binary data. It is up to the application layers to decide what that data represents. You probably are aware of all this, but I wanted to say it explicitly just in case.

Smile | :)

Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


GeneralRe: Threading Question Pin
Harvey Saayman18-Dec-09 5:56
Harvey Saayman18-Dec-09 5:56 
GeneralRe: Threading Question Pin
Luc Pattyn18-Dec-09 6:19
sitebuilderLuc Pattyn18-Dec-09 6:19 
GeneralRe: Threading Question Pin
Harvey Saayman18-Dec-09 7:49
Harvey Saayman18-Dec-09 7:49 
Question[Message Deleted] Pin
thungphan17-Dec-09 20:53
thungphan17-Dec-09 20:53 
AnswerMessage Closed Pin
17-Dec-09 21:25
stancrm17-Dec-09 21:25 
GeneralRe: convert int to byte array using shift operator Pin
thungphan17-Dec-09 21:42
thungphan17-Dec-09 21:42 
AnswerRe: convert int to byte array using shift operator Pin
harold aptroot17-Dec-09 21:52
harold aptroot17-Dec-09 21:52 
QuestionRuntime ToFront toBack? Pin
dennis_max2717-Dec-09 20:29
dennis_max2717-Dec-09 20:29 
AnswerRe: Runtime ToFront toBack? Pin
Saksida Bojan17-Dec-09 20:37
Saksida Bojan17-Dec-09 20:37 
GeneralRe: Runtime ToFront toBack? Pin
dennis_max2717-Dec-09 20:47
dennis_max2717-Dec-09 20:47 
GeneralRe: Runtime ToFront toBack? Pin
Saksida Bojan17-Dec-09 20:50
Saksida Bojan17-Dec-09 20:50 
GeneralRe: Runtime ToFront toBack? Pin
dennis_max2717-Dec-09 20:54
dennis_max2717-Dec-09 20:54 
GeneralRe: Runtime ToFront toBack? Pin
Saksida Bojan17-Dec-09 21:00
Saksida Bojan17-Dec-09 21:00 
GeneralRe: Runtime ToFront toBack? Pin
dennis_max2717-Dec-09 21:00
dennis_max2717-Dec-09 21:00 
AnswerRe: Runtime ToFront toBack? Pin
dennis_max273-Jan-10 22:37
dennis_max273-Jan-10 22:37 
Questionparsing javascript in realtime Pin
Haim Nachum17-Dec-09 19:39
Haim Nachum17-Dec-09 19:39 
QuestionDeploying Windows Application(C#) with SQL Server(2005) Pin
samrat.net17-Dec-09 19:18
samrat.net17-Dec-09 19:18 

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.