Dear All,
I developed a Multithreaded multiclient TCP server with following code.
public class TeslaServer
{
private static TcpListener _tcpListener;
public static void StartServer()
{
IPAddress localIpAddress = IPAddress.Parse("127.0.0.1");
var ipLocal = new IPEndPoint(localIpAddress, 9753);
_tcpListener = new TcpListener(ipLocal);
_tcpListener.Start();
WaitForClient();
}
private static void WaitForClient()
{
var stateObject = new object();
_tcpListener.BeginAcceptTcpClient(OnClientConnect, stateObject);
}
private static void OnClientConnect(IAsyncResult ar)
{
try
{
TcpClient tcpClient = _tcpListener.EndAcceptTcpClient(ar); // Finishing asynchronize calling
tcpClient.ReceiveBufferSize = 1 ...
Go to the complete details ...