TUniConnection: Only one usage of each socket address (protocol/network address/port) is normally permitted
Posted: Thu 16 Feb 2017 17:05
I'm dynamically creating two TUniConnection inside a thread. Each of those 2 connections is made to a different database inside the same endpoint. I just have a single thread running at a time inside the app, but have 5 apps running simultaneously. The connections are made towards an AWS RDS Aurora (MySQL compatible) database. At the end of the thread I disconnect and free the 2 connections. The threads run continuously.
After 4 hours or so I'm getting this on the OnError event:
This is how I'm creating the TUniConnection objects:
What am I doing wrong?
After 4 hours or so I'm getting this on the OnError event:
Code: Select all
THREAD thread_uniconnection1: Cannot connect to server on host 'XXX':
Only one usage of each socket address (protocol/network address/port) is normally permitted.
Socket Error Code: 10048($2740)Code: Select all
thread_uniconnection1:= TUniConnection.Create(nil);
thread_uniconnection1.Database:= XXX;
thread_uniconnection1.LoginPrompt:= False;
thread_uniconnection1.ProviderName:= 'MySQL';
thread_uniconnection1.Server:= XXX;
thread_uniconnection1.Username:= XXX;
thread_uniconnection1.Password:= XXX;
//events
thread_uniconnection1.OnError:= UniConnectionErrorHistory;
thread_uniconnection1.OnConnectionLost:= UniConnectionConnectionLostHistory;
thread_uniconnection1.AfterDisconnect:= UniConnectionHistoryAfterDisconnect;