Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
AnswerWrong forum - Try the ASP.NET forum. Pin
Pete O'Hanlon14-Jun-10 0:42
mvePete O'Hanlon14-Jun-10 0:42 
AnswerRe: Login dialog on page loads Pin
OriginalGriff14-Jun-10 0:43
mveOriginalGriff14-Jun-10 0:43 
AnswerRe: Login dialog on page loads Pin
Ramkithepower14-Jun-10 22:21
Ramkithepower14-Jun-10 22:21 
QuestionScalable Email service Pin
nitin_ion14-Jun-10 0:28
nitin_ion14-Jun-10 0:28 
AnswerRe: Scalable Email service Pin
OriginalGriff14-Jun-10 0:45
mveOriginalGriff14-Jun-10 0:45 
GeneralRe: Scalable Email service Pin
nitin_ion14-Jun-10 1:15
nitin_ion14-Jun-10 1:15 
QuestionFlow control using Asynch Sockets Pin
TimSWatson14-Jun-10 0:14
TimSWatson14-Jun-10 0:14 
AnswerRe: Flow control using Asynch Sockets Pin
Jimmanuel14-Jun-10 3:24
Jimmanuel14-Jun-10 3:24 
This is the pattern I'm familiar with (in pseudocode):
Socket socket;
Queue<Data> pendingData;
bool sending;

public void SendAsync (Data data)
{
    if (sending)
    {
	pendingData.Add(data);
    }
    else
    {
	sending = true;
	socket.BeginSend(data, new Callback(SendCallback));
    }
}

private void SendCallback ()
{
    socket.EndSend();
	
    if (pendingData.Count > 0)
    {		
        socket.BeginSend(pendingData.DequeueReasonableAmountOfData(), new Callback(SendCallback));
    }
    else
    {
        sending = false;
    }
}


This maintains only one outstanding asynchronous send operation at a time and the amount of data queued to be sent can easily be handled by user code. This is useful in case the queued data needs to be resent if the client disconnects/reconnects, or if you want to put a limit on how much data to queue to send or perhaps prioritize the queued data in some way.

Of course another important part would be to make sure the receiver is receiving in such a way that parsing the data isn't blocking the socket from immediately receiving the next packet being sent.
Badger | [badger,badger,badger,badger...]

GeneralRe: Flow control using Asynch Sockets Pin
TimSWatson14-Jun-10 3:34
TimSWatson14-Jun-10 3:34 
GeneralRe: Flow control using Asynch Sockets Pin
Jimmanuel14-Jun-10 4:17
Jimmanuel14-Jun-10 4:17 
QuestionApplication localization (culture) DLLs Pin
Eli Nurman14-Jun-10 0:04
Eli Nurman14-Jun-10 0:04 
AnswerRe: Application localization (culture) DLLs Pin
Pete O'Hanlon14-Jun-10 0:38
mvePete O'Hanlon14-Jun-10 0:38 
GeneralRe: Application localization (culture) DLLs Pin
Eli Nurman14-Jun-10 0:43
Eli Nurman14-Jun-10 0:43 
QuestionCan't add a reference to dsofile.dll [done] Pin
Ankit Rajpoot13-Jun-10 23:41
Ankit Rajpoot13-Jun-10 23:41 
QuestionLocking excel file while writing Pin
KaurGurpreet13-Jun-10 21:44
KaurGurpreet13-Jun-10 21:44 
AnswerRe: Locking excel file while writing Pin
Abhinav S13-Jun-10 21:52
Abhinav S13-Jun-10 21:52 
GeneralRe: Locking excel file while writing Pin
KaurGurpreet13-Jun-10 22:21
KaurGurpreet13-Jun-10 22:21 
AnswerRe: Locking excel file while writing Pin
Rhys Jacob13-Jun-10 23:39
Rhys Jacob13-Jun-10 23:39 
GeneralRe: Locking excel file while writing Pin
KaurGurpreet14-Jun-10 0:14
KaurGurpreet14-Jun-10 0:14 
GeneralRe: Locking excel file while writing Pin
Pete O'Hanlon14-Jun-10 0:40
mvePete O'Hanlon14-Jun-10 0:40 
GeneralRe: Locking excel file while writing Pin
KaurGurpreet14-Jun-10 20:55
KaurGurpreet14-Jun-10 20:55 
GeneralRe: Locking excel file while writing Pin
Pete O'Hanlon14-Jun-10 22:52
mvePete O'Hanlon14-Jun-10 22:52 
QuestionAODL ans .xls files Pin
SummerBulb13-Jun-10 21:34
SummerBulb13-Jun-10 21:34 
QuestionDatagridview CellValidating [Solved] Pin
jojoba201113-Jun-10 21:34
jojoba201113-Jun-10 21:34 
QuestionReport Service - passing XML paramter to filter data Pin
thenewbee13-Jun-10 21:21
thenewbee13-Jun-10 21:21 

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.