Click here to Skip to main content
15,923,689 members
Home / Discussions / C#
   

C#

 
GeneralRe: Modem Control Pin
Heath Stewart7-Jan-05 11:45
protectorHeath Stewart7-Jan-05 11:45 
GeneralApp.Config Question... Pin
Richard Parsons7-Jan-05 8:24
Richard Parsons7-Jan-05 8:24 
GeneralRe: App.Config Question... Pin
Nick Parker7-Jan-05 8:38
protectorNick Parker7-Jan-05 8:38 
GeneralRe: App.Config Question... Pin
Richard Parsons7-Jan-05 9:12
Richard Parsons7-Jan-05 9:12 
QuestionHow can I make the datagrid invisible and have the save button come up Pin
macupryk7-Jan-05 8:10
macupryk7-Jan-05 8:10 
AnswerRe: How can I make the datagrid invisible and have the save button come up Pin
Nick Parker7-Jan-05 8:30
protectorNick Parker7-Jan-05 8:30 
GeneralBeginRead() EndRead() methods with NetworkStream class Pin
mikeyhardingboyo7-Jan-05 6:53
mikeyhardingboyo7-Jan-05 6:53 
GeneralRe: BeginRead() EndRead() methods with NetworkStream class Pin
Heath Stewart7-Jan-05 7:38
protectorHeath Stewart7-Jan-05 7:38 
mikeyhardingboyo wrote:
i originally implemented a endless while loop which checked for data in the incoming data buffer but obviously this caused my computer to crash with the number of checks it was doing

That's hardly obvious. I've done a lot of checks in programs and they've never crashed the app or the computer. So have many other developers. It's what applications do.

Understand that when you use BeginRead a read is started on another thread. The read itself is a blocking call. It does not return until there's data to actually read. If you keep calling BeginRead and there's never any data, then you've got many threads piling up, wasting memory, and doing nothing. Now all of a sudden when data arrives you've got a race condition.

Never use asynchronous Begin* methods without ever calling their corresponding End* functions. The mess you got into is the mess that will happen when you don't use asynchronous methods correctly.

If you want to know if data is available for a NetworkStream, check the NetworkStream.DataAvailable property. If you had checked the documentation - especially important if you're new to .NET development - you should've noticed this obviously named method.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: BeginRead() EndRead() methods with NetworkStream class Pin
mikeyhardingboyo7-Jan-05 8:04
mikeyhardingboyo7-Jan-05 8:04 
GeneralRe: BeginRead() EndRead() methods with NetworkStream class Pin
Heath Stewart7-Jan-05 9:15
protectorHeath Stewart7-Jan-05 9:15 
GeneralRe: BeginRead() EndRead() methods with NetworkStream class Pin
mikeyhardingboyo7-Jan-05 17:19
mikeyhardingboyo7-Jan-05 17:19 
GeneralRe: Strange Pin
bouli7-Jan-05 6:52
bouli7-Jan-05 6:52 
GeneralRe: Strange Pin
Heath Stewart7-Jan-05 7:52
protectorHeath Stewart7-Jan-05 7:52 
GeneralRe: Strange Pin
bouli7-Jan-05 8:54
bouli7-Jan-05 8:54 
GeneralRe: Strange Pin
Heath Stewart7-Jan-05 9:03
protectorHeath Stewart7-Jan-05 9:03 
GeneralRe: Strange Pin
bouli7-Jan-05 9:10
bouli7-Jan-05 9:10 
GeneralStrange Pin
bouli7-Jan-05 6:30
bouli7-Jan-05 6:30 
GeneralRe: Strange Pin
Heath Stewart7-Jan-05 6:44
protectorHeath Stewart7-Jan-05 6:44 
GeneralRe: Strange Pin
bouli7-Jan-05 6:47
bouli7-Jan-05 6:47 
Generaldate time control Pin
Anonymous7-Jan-05 5:35
Anonymous7-Jan-05 5:35 
GeneralRe: date time control Pin
Heath Stewart7-Jan-05 6:42
protectorHeath Stewart7-Jan-05 6:42 
GeneralRe: date time control Pin
Anonymous7-Jan-05 7:18
Anonymous7-Jan-05 7:18 
GeneralRe: date time control Pin
Heath Stewart7-Jan-05 7:33
protectorHeath Stewart7-Jan-05 7:33 
GeneralUdp. How to recieve. Pin
Umair Ahmad khan7-Jan-05 5:05
Umair Ahmad khan7-Jan-05 5:05 
GeneralRe: Udp. How to recieve. Pin
Heath Stewart7-Jan-05 6:34
protectorHeath Stewart7-Jan-05 6:34 

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.