Client connect to wrong port

delphi
zeroconf

(Armindo DA SILVA) #1

Hello,

I have a RO client that list with ZeoConf all servers available.
I have 2 RO servers available, one with Port 8095 and the other on Port 8096.

I use the same ROChannel, ROMessage, RORemosteService to connect on each Server.
I use this procedure :
Function TClientForm.CanUseServer(Server_URL: String): Boolean;
Var
OldURi, lUri: TROUri;

Begin
  OldURi := TROUri.Create;
  lUri := TROUri.Create;
  Try
    OldURi.Assign(ROChannel.TargetUri);
    Try
      lUri.URI := Server_URL;
      fCurrentTargetUri.Assign(lUri);
      ROChannel.TargetUri := fCurrentTargetUri;
      RORemoteService.Channel := ROChannel;

      result := (RORemoteService As IChorus_Service).Can_Connect_To_Server(Server_Password);

    Except
      On E: Exception Do
        cbTargetUrl.Font.Color := clRed;
    End;
  Finally
    If lUri <> Nil Then
      FreeAndNil(lUri);
    fCurrentTargetUri.Assign(OldURi);
    ROChannel.TargetUri := fCurrentTargetUri;
    If OldURi <> Nil Then
      FreeAndNil(OldURi);
  End;
End;

In twi different cases the server_URL parameter passed to the function are different but the it is alway the same server that receive the request, it’s like if the Port isn’t taken in account.
Any Idea ?

Best regards

Armindo


(antonk) #2

Hello

What is the exact ROChannel type? For example the reason for this behavior can be that f.e. the channel already established persistent connection with the server and now ignores all TargetUri changes.


(Armindo DA SILVA) #3

Hello,
SupertTCP
I have found a way to make it working.
I had to set the active to false before changing the URL then to true to make it working.
Best regards


(antonk) #4

Hello

For SuperTCP the reason of this issue was exactly as I’ve stated above:

I’ll log an issue to review this behavior.


(RemObjects) #5

Thanks, logged as bugs://81581


(RemObjects) #6

bugs://81581 got closed with status nochangereq.


(EvgenyK) #7

this is as expected - port is changed only when channel is activated
ofc, we can raise exception when port is changed and channel is active, but I think, better to leave current behavior.