Jump to content

Recommended Posts

The IP or Port is already in use -or- the IP does not exist.

UniGUI uses default settings for IP and Port unless you override them.

I use the following:-

procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject);


AddNewBindingsFlag:= ?
HttpPort:= ?
BindToIpStr:= ?
SslPort:= ?
SslPassword:= ?  

  if AddNewBindingsFlag = True then begin
    // Remove Any IDE Bindings
    // Add binding for http
    with Bindings.Add do begin
      IP:= '';
      Port:= 0;
    // Set http binding/port
    if UniServerModule.Bindings.Count > 0 then begin
      // Set Binding [0] http
      UniServerModule.Bindings.Items[0].Port:= HttpPort;
      UniServerModule.Bindings.Items[0].IP:=   BindToIpStr;
      UniServerModule.Bindings.Items[0].BroadcastEnabled:= True;
    end else begin
      UniServerModule.Port:= HttpPort; 
    if UseSslFlag = True then begin
      // Remove Any IDE Bindings
      // Add binding for https
      with SSL.SSLBindings.Add do begin
        IP:= '';
        Port:= 0;
      // Set https binding/port
      if UniServerModule.SSL.SSLBindings.Count > 0 then begin
        // Set Binding [0] https
        UniServerModule.SSL.SSLBindings.Items[0].Port:= SslPort;
        UniServerModule.SSL.SSLBindings.Items[0].IP:= BindToIpStr;
        UniServerModule.SSL.SSLBindings.Items[0].BroadcastEnabled:= True;
      end else begin
        UniServerModule.SSL.SSLPort:= 0;
      // Assign Certificate 
      SSL.SSLOptions.RootCertFile:= UniServerModule.StartPath + 'root.pem';
      SSL.SSLOptions.CertFile:=     UniServerModule.StartPath + 'cert.pem';
      SSL.SSLOptions.KeyFile:=      UniServerModule.StartPath + 'key.pem';  
      SSL.SSLPassword:=             SslPassword;
      SSL.Enabled:=                 True;
    end; // UseSslFlag
  end; // AddNewBindingsFlag


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...