Answer the question
In order to leave comments, you need to log in
How to write a server client in C#?
Tell me where you can learn about how to write your server-client technology, that is, both the server and the client itself. What are the best protocols to interact with? What and approximately how to use to write a messenger for two or more remote clients from the server?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
System.Net.Sockets (your protocol will be based on TCP) or libraries for WebSocket (your protocol will be based on Websocket, which is based on TCP), the libraries are open source.
At first glance, it’s simple, but if you need to keep the connection open for a long time, then you need to ensure keep-alive, and if you also correctly handle Internet connection failures, then you still have to implement repeated connection attempts and reading data in parts (into the byte[] buffer) , to test internet problems, use programs like NetLimiter and write test code that automatically disconnects the current network when a packet has already started to be sent, or has not yet begun.
But it's not so difficult, just apply multithreading: create a thread for accepting clients, and also a separate thread for working with each client.
1) WCF
2) OWIN Self Host
Everything is ready to use.
There is no need to work with TCP directly, the wrappers are built into .NET.
For me, too, an interesting question that was asked by kos_dev. Perhaps there is some kind of book similar to GOF patterns that describes different technologies and architectures of client-server applications?
Write to VK: https://vk.com/dev_0x00
I have more than enough experience in writing group messengers: D
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question