Connection issue with sql-Raspberry PI - sql

I am currently using Raspberry Pi as my Server for IOT. I am trying to connect my client side to server, so that it can communicate with the server. But I am getting following error:
Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in F:\XAMPP\htdocs\plugload-workaround\plugLoad\plugload-pi\plugload\production\plugLoad4.php on line 178
Could you please help me in resolving that.
If the issue is due to security reasons, please help me in correcting the security details.

Related

Why does my secure websocket connection with Godot fail when i connect from Australia to Germany?

please be patient with me because this is my first question ever on this platform. Thanks.
This is the code for a minimal server using the secure websocket protocol wss:// in godot (GDScript):
Gist on github
It works as expected when i connect from my home to my Virtual Private Server hosted in Germany or via VPN from other locations (e.g. US or Europe).
It does not work as expected when friends connect from India or Australia or if i reproduce it with a VPN (e.g. Argentina or Australia).
index.js:8 WebSocket connection to 'wss://(hidden):port/' failed: Error in connection establishment: net::ERR_SOCKET_NOT_CONNECTED.
I looks like the connection fails only if the physical distance between server and client is that long.
The problem might be related to SSL because everything works as expected when i use the normal websocket protocol. I tested the openssl -connect command from home and via VPN: both are good. I also checked my ssl configuration on https://decoder.link/sslchecker/. No issues detected.
This problem might be related to godot because I set up a nodejs secure websocket server, this works, even when i connect from Australia.
Now i dont really know how to proceed to fix this issue so i ask you to point me in the right direction.
Useful documentation on godot docs: WebSocketServer WebSocketClient
Edit 1:
After more tests it got more confusing:
When connecting from India with traffic on the internet connection:
WebSocket connection to 'wss://myDomain:port/' failed: Connection closed before receiving a handshake response
connnetion error
connection close request from server received... client will close the connection
disconnected unexpected
sometimes it even works (when network is not busy)
When connection from Australia: sometimes the ERR_SOCKET_NOT_CONNECTED or the Connection closed before receiving a handshake response connnetion error error comes up.
Edit 2:
only Firefox works, Chrome or Native client don't. I seems Firefox can establish the connection better if the distance is very big between server and client.

Error occurred during the pre-login handshake, due to AntiVirus?

I need your expertise on one of my issues. I often get an intermittent issue from our Power BI on-premises Gateway to SQL connectivity
Error from gateway log
Error: A connection was successfully established with the server, but
then an error occurred during the pre-login handshake. (provider: SSL
Provider, error: 0 - The wait operation timed out.)
The difficult part here is it's very difficult to reproduce ☹️ Whenever I tried the connectivity from the gateway to SQL server, it succeeds but at some very rare case, it fails.
Steps we did to find the root cause
Checked in both the gateway server and SQL server TLS 1.2 only is
enabled, other versions of TLS are disabled
created a .udl file and tried the connectivity but got the error like
[DBNETLIB] ConnectionOpen( SECCreateCredentials().] SSL Security
error.
Finally, we contacted our internal support team, they told to run the network tracer. So we did.
After some long times, we had the luck to capture the error in the network tracer. (Below Image)
Support team told like:
We see that client (gateway server) is sending Client hello after 14 seconds for the TLS SSL handshake, this delay is causing the connection to fail as connection needs to get established in 15 seconds.
We see the same pattern, where the client is causing delay on multiple instances of the communication.
And such delay is generally caused by the Antivirus
My question:
Is this really the Antivirus issue? If so then why it's not happening
all the times?
P.S I know this question is already asked in SO and possible for duplicate, but my real question is this antivirus would be a possible cause for this?
The issue is finally resolved after so many attempts. The below is the solution worked for us
• Azure AD join, where the connections head to the “login.microsoft.com” and delay the connections. There are few settings from registry and GPO that needs to be performed to disable this Auto Azure WorkPlace join.
https://learn.microsoft.com/en-us/azure/active-directory/device-management-troubleshoot-hybrid-join-windows-current
It talks about restricting the server from joining AzureAD through a GPO, which resolves to:
HKLM\SOFTWARE\Policies\Microsoft\Windows\WorkplaceJoin\ key:
autoWorkplaceJoin = 0
• Connections headed to http://ctldl.windowsupdate.com , refer the below article that talks about this issue.
https://blogs.technet.microsoft.com/askds/2018/04/10/tls-handshake-errors-and-connection-timeouts-maybe-its-the-ctl-engine/
To disable it: • Create a backup of this registry key (export and save
a copy)
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\SystemCertificates\AuthRoot • Then create the following DWORD registry values under the key
“EnableDisallowedCertAutoUpdate”=dword:00000000
“DisableRootAutoUpdate”=dword:00000001
I hope this helps someone in the future !

Azure SQL Server: Error occurred during the pre-login handshake

Occasionally, when I go to connect to my Azure SQL Server through either Power BI or SSMS, I get the following error:
A connection was successfully established with the server, but then an
error occurred during the pre-login handshake. (provider: TCP
Provider, error: 0 - The semaphore timeout period has expired.)
(Microsoft SQL Server, Error: 121)
There are numerous questions about this topic, but very few address this for Azure SQL Server. My IP address is added to the firewall (and works sometimes!) I have tried increasing the connection time out. I have tried to look at the "netsh WinSock Show Catalog" information as directed by the answer to this question, but nothing looked incorrectly formatted.
Has anyone seen any other reason for this error? It popped up a few days ago, went away for a few days, and is back now, but I haven't changed anything in the meantime.
The problem ended up being that my computer had disconnected from my company's VPN.
Error 121 has always been considered a network related error as you can read in this Microsoft Support article. The Internet service you receive, network adapters are things you should consider examine.
Network connectivity problems have various causes, but they typically
occur because of incorrect network adapters, incorrect switch
settings, faulty hardware, or driver issues. Some connectivity
symptoms are intermittent and do not clearly point to any one of these
causes.
Typical error messages include the following:
Error 121: "The semaphore timeout period has expired"
(ERROR_SEM_TIMEOUT).
Please consider to click the "Options" button of SQL Server Management Studio, on the "Connection Properties" tab, try setting a greater value for the "Connection time-out" setting.

wcf - No connection could be made because the target machine actively refused it

I created a WCF service. It worked well yesterday. When I entered service address, I got message returned as expected. However, when I run it today, I received error message:
In IE: [Fiddler] The socket connection to localhost failed.
ErrorCode: 10061. No connection could be made because the target machine actively refused it [::1]:47423
In Firefox: Firefox can't establish a connection to the server at the site
In Fiddle2: HTTP: 502
How to solve this problem? Thanks.
Generally with these issues is either the service is not running or you're url is incorrect. Without more specific information it's impossible to tell.

Uploading files to remote server using WCF

I am new to WCF, I am trying to upload files to remote server using a windows service and WCF. When i run my code i get the below error.
An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll
Additional information: Could not connect to net.tcp://74.208.195.53:5000/. The connection attempt lasted for a time span of 00:00:21.0122019. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.208.195.53:5000.
I tried using the sample project provided in this link http://www.codeproject.com/KB/WCF/WCFDownloadUploadService.aspx
I read in other blogs that, the port has to be allowed throught the firewall on the server.i did that even tried turning off the firewall on the server but it dint help.
Can someone please guide me how i could get this issue resolved.Any help would be highly appreciated. I am using win7 and the remote server is windows server 2008.
Thanks
In some circumstances you need to enable tcp on the server. this post might help