set TcpClient parameters
use WeakReference when retaining MemoryStreams to avoid memory leak