What is the difference with async and sync in Tcp Socket? [on hold]Optimization expression evaluation...

How to avoid Replace substituting subscripts?

Parsing a string of key-value pairs as a dictionary

What is a jet (unit) shown in Windows 10 calculator?

Is there some relative to Dutch word "kijken" in German?

Strange Sign on Lab Door

Why exactly do action photographers need high fps burst cameras?

Why is working on the same position for more than 15 years not a red flag?

Are there neural networks with very few nodes that decently solve non-trivial problems?

Why avoid shared user accounts?

What is this metal M-shaped device for?

Is a debit card dangerous in my situation?

Does Improved Divine Strike trigger when a paladin makes an unarmed strike?

Quenching swords in dragon blood; why?

Why doesn't "auto ch = unsigned char{'p'}" compile under C++ 17?

Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?

How to prevent users from executing commands through browser URL

Can we use the stored gravitational potential energy of a building to produce power?

Can a person refuse a presidential pardon?

Removing c-style comments with sed

My cat mixes up the floors in my building. How can I help him?

How to explain planetary rings pulsating?

Do authors have to be politically correct in article-writing?

Solubility of a tribasic weak acid

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?



What is the difference with async and sync in Tcp Socket? [on hold]


Optimization expression evaluation challengeTCP async socket server client communicationSending data through a TCP streamCan this be improved by working directly with the MemoryStream?async tcp server using async/awaitSocket application using TPLEnsuring no race conditions in my concurrent/parallel ForEachAsync methodC# Async Socket WrapperAsync test client for TCP socketUsing mergesort to sort lexicographically













-4












$begingroup$


Does it have speed difference? Which one is more responsive? Does it matter which one to use?
The codes to these 3 questions:



void EndReading(IAsyncResult result)
{
int size = ((NetworkStream)result.AsyncState).EndRead(result);
}
void Start() => tcpClient.BeginRead(buffer, 0, 30000, EndReading, null);


Second:



async Task Read(TcpClient cl)
{
int size = 0;
if ((size = cl.GetStream().ReadAsync(buffer, 0, 30000)) != 0)
{
//...
}
}
void Start() => Task.Run(Read).Wait();


The same for writing but instead of if and ReadAsync just WriteAsync










share|improve this question







New contributor




user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by 200_success, vnp, Carcigenicate, Heslacher, Jamal 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, vnp, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.
















  • $begingroup$
    Welcome to Code Review. Unfortunately this question does not match what this site is about. Reviewers need more than hypothetical/stub code. For more information, see this meta post.
    $endgroup$
    – Sᴀᴍ Onᴇᴌᴀ
    2 days ago


















-4












$begingroup$


Does it have speed difference? Which one is more responsive? Does it matter which one to use?
The codes to these 3 questions:



void EndReading(IAsyncResult result)
{
int size = ((NetworkStream)result.AsyncState).EndRead(result);
}
void Start() => tcpClient.BeginRead(buffer, 0, 30000, EndReading, null);


Second:



async Task Read(TcpClient cl)
{
int size = 0;
if ((size = cl.GetStream().ReadAsync(buffer, 0, 30000)) != 0)
{
//...
}
}
void Start() => Task.Run(Read).Wait();


The same for writing but instead of if and ReadAsync just WriteAsync










share|improve this question







New contributor




user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by 200_success, vnp, Carcigenicate, Heslacher, Jamal 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, vnp, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.
















  • $begingroup$
    Welcome to Code Review. Unfortunately this question does not match what this site is about. Reviewers need more than hypothetical/stub code. For more information, see this meta post.
    $endgroup$
    – Sᴀᴍ Onᴇᴌᴀ
    2 days ago
















-4












-4








-4





$begingroup$


Does it have speed difference? Which one is more responsive? Does it matter which one to use?
The codes to these 3 questions:



void EndReading(IAsyncResult result)
{
int size = ((NetworkStream)result.AsyncState).EndRead(result);
}
void Start() => tcpClient.BeginRead(buffer, 0, 30000, EndReading, null);


Second:



async Task Read(TcpClient cl)
{
int size = 0;
if ((size = cl.GetStream().ReadAsync(buffer, 0, 30000)) != 0)
{
//...
}
}
void Start() => Task.Run(Read).Wait();


The same for writing but instead of if and ReadAsync just WriteAsync










share|improve this question







New contributor




user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




Does it have speed difference? Which one is more responsive? Does it matter which one to use?
The codes to these 3 questions:



void EndReading(IAsyncResult result)
{
int size = ((NetworkStream)result.AsyncState).EndRead(result);
}
void Start() => tcpClient.BeginRead(buffer, 0, 30000, EndReading, null);


Second:



async Task Read(TcpClient cl)
{
int size = 0;
if ((size = cl.GetStream().ReadAsync(buffer, 0, 30000)) != 0)
{
//...
}
}
void Start() => Task.Run(Read).Wait();


The same for writing but instead of if and ReadAsync just WriteAsync







c# asynchronous






share|improve this question







New contributor




user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









user193954user193954

1




1




New contributor




user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user193954 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by 200_success, vnp, Carcigenicate, Heslacher, Jamal 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, vnp, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.







put on hold as off-topic by 200_success, vnp, Carcigenicate, Heslacher, Jamal 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – 200_success, vnp, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.












  • $begingroup$
    Welcome to Code Review. Unfortunately this question does not match what this site is about. Reviewers need more than hypothetical/stub code. For more information, see this meta post.
    $endgroup$
    – Sᴀᴍ Onᴇᴌᴀ
    2 days ago




















  • $begingroup$
    Welcome to Code Review. Unfortunately this question does not match what this site is about. Reviewers need more than hypothetical/stub code. For more information, see this meta post.
    $endgroup$
    – Sᴀᴍ Onᴇᴌᴀ
    2 days ago


















$begingroup$
Welcome to Code Review. Unfortunately this question does not match what this site is about. Reviewers need more than hypothetical/stub code. For more information, see this meta post.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
2 days ago






$begingroup$
Welcome to Code Review. Unfortunately this question does not match what this site is about. Reviewers need more than hypothetical/stub code. For more information, see this meta post.
$endgroup$
– Sᴀᴍ Onᴇᴌᴀ
2 days ago












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Fairchild Swearingen Metro Inhaltsverzeichnis Geschichte | Innenausstattung | Nutzung | Zwischenfälle...

Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...

Marineschifffahrtleitung Inhaltsverzeichnis Geschichte | Heutige Organisation der NATO | Nationale und...