Following code below should reconnect my audio server if it was found to be disconnected now all is good the timer event is called and the system message shows its reconnecting however it seams the connect procedure fails to be called as it dont reconnect.

procedure TGizletView.AudioConTimerTimer(Sender: TObject);
begin
  AudioConTimer.Enabled := False;
  AddSystemMessage('Reconnecting to MCP...', SFontDialog);
  ConnectToAudioServer('ADDR', 'PORT', 'PASSWORD');
end;

code below is were it fails.

procedure TGizletView.ConnectToAudioServer(const IP, Port, Key: String);
begin
  AudioClient.srvMasterkey := Key;
  AudioClient.connect(UserID, RoomID, IP, Port);
end;

it seams it not able to be called yet if I do same code as a tbutton it would work fine if pressed, anyone got anyone got ideas why would this be happening??

Thanks

I don't see anything wrong with this, assuming "'ADDR', 'PORT', 'PASSWORD'" is just dummy data to avoid publishing your real data, and that you enable the timer somewhere.

I suggest you put a break point on the first line of both of these routines and step through the code line-by-line in the debugger. Examine the variable values at each step to be sure you have valid data. Let us know what you find; I am curious.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.