Click here to Skip to main content
15,895,256 members
Home / Discussions / C#
   

C#

 
AnswerMessage Closed Pin
18-Dec-09 2:50
stancrm18-Dec-09 2:50 
GeneralRe: zedgraph Pin
jashimu18-Dec-09 4:09
jashimu18-Dec-09 4:09 
QuestionHide database file from user Pin
NarendraSinghJTV18-Dec-09 1:53
NarendraSinghJTV18-Dec-09 1:53 
AnswerRe: Hide database file from user Pin
Ashfield18-Dec-09 2:02
Ashfield18-Dec-09 2:02 
GeneralRe: Hide database file from user Pin
NarendraSinghJTV18-Dec-09 2:33
NarendraSinghJTV18-Dec-09 2:33 
GeneralRe: Hide database file from user Pin
Saksida Bojan18-Dec-09 3:57
Saksida Bojan18-Dec-09 3:57 
GeneralRe: Hide database file from user Pin
NarendraSinghJTV18-Dec-09 17:51
NarendraSinghJTV18-Dec-09 17:51 
GeneralRe: Hide database file from user Pin
Saksida Bojan18-Dec-09 20:42
Saksida Bojan18-Dec-09 20:42 
GeneralRe: Hide database file from user Pin
Ashfield18-Dec-09 8:53
Ashfield18-Dec-09 8:53 
GeneralRe: Hide database file from user Pin
NarendraSinghJTV18-Dec-09 17:50
NarendraSinghJTV18-Dec-09 17:50 
GeneralRe: Hide database file from user Pin
Ashfield18-Dec-09 20:25
Ashfield18-Dec-09 20:25 
GeneralRe: Hide database file from user Pin
NarendraSinghJTV19-Dec-09 0:23
NarendraSinghJTV19-Dec-09 0:23 
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
mvePete 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 

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.