I develop application with two main option grouped by groupBox in main form. First option is run server with specific behaviour for example I choose TCP protocol, type IP address, port number and atfter that I click run button which generate independent forms with this specific server. Second option is client which is analogous to first option. Client and server can send/receive information to via sockets. My question is what is proper way to build this application? I try to put every server and client to independent thread  but I wonder is it a good solution because I find similar question where there is no multithread answer.
Multi-threaded winforms with multiple child forms using sockets
c#;winforms;sockets
Edit: I see that the post is old, however I'll toss the answer up anyways.In my humble opinion, I think the proper way would be to design this in three pieces.Server.cs - the logic that behind the serverClient.cs - the logic that behind the clientYour UI.You would only need two threads, one that the UI runs on which you don't have to worry about and one that either the Server or Client runs on (which you do have to worry about). You have two ways to handle the multi-threaded work. Either on the UI (checking for cross-thread business, invoking, etc) or in the class it self. I personally prefer the latter.Food for thought:I personally like to trigger events which the UI can subscribe to and react accordingly. I tend to use AsyncOperation.Post() to handle the cross-threaded stuff.Look into this: https://msdn.microsoft.com/en-us/library/system.componentmodel.asyncoperation.post(v=vs.110).aspx