U
U
UrbanRider2012-07-13 10:32:08
Programming
UrbanRider, 2012-07-13 10:32:08

Asynchronous TCP server in C#. What to read? Resolved

Good day everyone.
I'm trying to figure out the operation of an asynchronous TCP server in C # according to the msdn article:
msdn.microsoft.com/ru-ru/library/dd335942.aspx

As far as I understand, the data is written to the connection buffer.

The netlist is private, as is almost everything in the class other than the Start function.

Tell me how to properly process the received data?
I suspect that there should be an infinite loop after the Start procedure in the main program, which should access the server class instance and read the buffer of each connection.

Of course, I can make the field I need public, but I understand that this is not correct.

Can anyone tell me how to work with such a class? Or poke in msdn where work with this business proceeds. I would be very grateful for any useful information.
Can someone suggest a good book/article.
I would like to figure out how to properly make an asynchronous server in c#.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2012-07-13
@UrbanRider

Firstly, for endless cycles, it is worth burning at the stake. Here you need to write / use event handlers, because the consumption of processor time with infinite loops will be just awful.
You should have problems like “how to transfer data from the listener thread to the handler thread as quickly as possible” and not public / private. Data can be exchanged through callbacks. All the joy of writing a TCP server is callbacks, thread synchronization, and so on.
In general, read the article. All these issues seem to be addressed there.

U
UrbanRider, 2012-07-13
@UrbanRider

Issue resolved. Thank you very much.
I do not understand where to click to close the question.
Fesor, TheHorse thank you very much again.
I will smoke the professional .net network programming book, and thanks for the link to msdn.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question