Async lock not allowed

Looks like the problem that you have is that threads will block while acquiring the lock, so your method is not completely async. To solve this you can use SemaphoreSlim.WaitAsync private readonly SemaphoreSlim readLock = new SemaphoreSlim(1, 1); public async Task UpdateDetailsAsync() { //I want every request to wait their turn before requesting (using the … Read more

Sending and receiving data over a network using TcpClient

First, I recommend that you use WCF, .NET Remoting, or some other higher-level communication abstraction. The learning curve for “simple” sockets is nearly as high as WCF, because there are so many non-obvious pitfalls when using TCP/IP directly. If you decide to continue down the TCP/IP path, then review my .NET TCP/IP FAQ, particularly the … Read more

How to check if TcpClient Connection is closed?

I wouldn’t recommend you to try write just for testing the socket. And don’t relay on .NET’s Connected property either. If you want to know if the remote end point is still active, you can use TcpConnectionInformation: TcpClient client = new TcpClient(host, port); IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties(); TcpConnectionInformation[] tcpConnections = ipProperties.GetActiveTcpConnections().Where(x => x.LocalEndPoint.Equals(client.Client.LocalEndPoint) && x.RemoteEndPoint.Equals(client.Client.RemoteEndPoint)).ToArray(); … Read more

Error: TCP Provider: Error code 0x2746. During the Sql setup in linux through terminal

[UPDATE 17.03.2020: Microsoft has released SQL Server 2019 CU3 with an Ubuntu 18.04 repository. See: https://techcommunity.microsoft.com/t5/sql-server/sql-server-2019-now-available-on-ubuntu-18-04-supported-on-sles/ba-p/1232210 . I hope this is now fully compatible without any ssl problems. Haven’t tested it jet.] Reverting to 14.0.3192.2-2 helps. But it’s possible to solve the problem also using the method indicated by Ola774, not only in case of … Read more

In C#, how to check if a TCP port is available?

Since you’re using a TcpClient, that means you’re checking open TCP ports. There are lots of good objects available in the System.Net.NetworkInformation namespace. Use the IPGlobalProperties object to get to an array of TcpConnectionInformation objects, which you can then interrogate about endpoint IP and port. int port = 456; //<— This is your value bool … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)