I don't think this is a complete code. I suggest you profile timing of your whole application to find out. If you don't want to get and install a profiler, you can simply profile it by adding some timing codes and writing log messages. Please see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx[
^].
Some notes:
You mention that you create server's
TcpListener
, but you actually don't do it. It's not clear what you want to achieve with the listener. If you only use the
TcpClient
, you would usually need and extra thread for communication. If you use
TcpListener
, you should have at least two threads for communication: one accepting new connections from clients, another one reading/writing data from/two a network stream or socket. Please see my past answers:
Multple clients from same port Number[
^],
an amateur question in socket programming[
^].
—SA