Sponsored Ad

Friday, October 30, 2009

Socket Programming in C#

About socket programming. In the previous article they created a client but the client used to make blocking IO calls (Get) to read data at regular intervals (by clicking the button Rx). But as I said in my previous article, that the model works well in a real application. Also, since Windows is an event-based process, the application (client) should get notifications whenever any data is received so that the client can read instead of voting for the client continuously the data .
Well, that is possible with a tiny effort. If you read the first part of this article, you already know that the Socket class in the namespace Systems.Net.Sockets has several methods such as receiving and Music, that are blocking calls. In addition there's also functions as BeginReceive, etc. These are for BeginSend E / S asynchronous. For example, there's at least three problems with the reception of locking:

When you call the receive function call blocks if no data is present, the call blocks until some data arrives. Even if data of the calling when reception is not known when to call next time. That has to make choices, which is not an efficient way.

0 comments:

Post a Comment

Sponsored Ad

Website Update

Followers