NetTalk Central

Author Topic: Listen on Port Number  (Read 4921 times)

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Listen on Port Number
« on: March 24, 2009, 07:02:51 AM »
Hmmmm...

On the Nettalk or NetSimple object extension on the Settings tab on General, you can set the "Listen on Port Number".

However, I have a bit of a problem here.  I have one .exe that runs and in the .ini file I specify what SQL Database to open.

Now the problem is that one client have 2 different databases, and by default I use port 47245.  Now the 2nd database need to be on a different port...

So it is easy, change the port number and recompile the app.  But now I will have to do this each time I change the app and then I must make sure that the girls in the office don't get the 2 different exe's all messed up or copy the wrong one to a different client, etc.

Is it possible to override the default port number in an .ini file or something??

Please tell me this is possible and how  :)

Regards
Charl

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Listen on Port Number
« Reply #1 on: March 24, 2009, 02:32:10 PM »
Yes, set the port number as a local variable. You can then load that from a ini file.

I have a similar setup as you describe with SQL and I set lots of other NTW settings via variables like SSL etc. I just add these to the SQL Connect window so they can be changed at runtime.

Kev

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Listen on Port Number
« Reply #2 on: March 25, 2009, 03:11:00 AM »
Kevin,

OK that works thanks.  One problem though, I now need to run the same exe twice, call it GWeb.exe.

I renamed it to GWeb2.exe but it still pick up the original ini file name.  Also, I cannot run GWeb.exe and GWeb2.exe at the same time.

Any ideas?

Charl

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Listen on Port Number
« Reply #3 on: March 25, 2009, 04:10:12 AM »
I create separate folders for each client so I don't need to rename the files. If I do any updates I just copy it into each folder. I set the ini file to read from the application folder.

I have also plumbed in changes so I can run 1 exe for all clients and it will use the relevant MSSQL DB - I just haven't got around to testing it extensively yet.

Kev

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Listen on Port Number
« Reply #4 on: March 25, 2009, 04:57:08 AM »
Ok, I tried this, in a SQLWeb and a SQLWeb2 directory, but it tells me

 'Warning GWeb Server cannot load as aonther instance is allready running'

Obviously I need to install these as Services.

????

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Listen on Port Number
« Reply #5 on: March 25, 2009, 08:13:04 PM »
you must have something set to only allow one instance of the exe to run at a time. do you have any templates installed which do that? You could make them a service but it is not necessary.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Listen on Port Number
« Reply #6 on: March 25, 2009, 11:54:02 PM »
Hi Charl,

You've got a template in limiting it to one instance. (probably SelfService).
If it is self service then just check the option on the global exension.

You also don't need to rename the exe, just start the exe with a command line parameter. For example
bob.exe /Port=123
bob.exe /Port=456

Inside the app you can read the setting from the command line, using the clarion COMMAND function, only falling back on the ini file if the parameter doesn't exist.

Or you can pass the name of the ini on the command line, and use that to determine which bunch of settings you want to use.

cheers
Bruce