Closed muhammetunal closed 4 years ago
note that Old versions were
Could you be more specific on that?
I tried to add the "connect -u" parameter, but couldnt success in that either
Yesterday I added an overwrite, which enables this parameter always (disables the socket port reuse), when running inside an Windows Sandox Vm - I doubt it, but maybe thats broken?
all_address = [(
srv_config['ip'], srv_config['port'],
(srv_config['backlog_main'] if 'backlog_main' in srv_config else srv_options['backlog']['def']),
(srv_config['reuse_main'] if 'reuse_main' in srv_config else False if getpass.getuser() == 'WDAGUtilityAccount' else srv_options['reuse']['def'])
)]
log_address = "TCP server listening at %s on port %d" %(srv_config['ip'], srv_config['port'])
Normally this all should work fine - can anyone else reproduce this? As my testing systems had no problems with it (Linux, Windows Sandbox).
And maybe you could cleanup your issue a little bit?
we can fix this either with editing pykms_server.py or with kms-winservice.py. I prefer doing it in pykms_server.py. this will be better for code reusability.
so I am open to any sugessions. thanks in advance
Okay. When you System does not support port reusing you'll need to add connect -u
to pykms_Server.py
. Just a quick check: Please insert the following code in place of the current fix (somewhere in pykms_Server.py
) for such cases - does it work then?
all_address = [(
srv_config['ip'], srv_config['port'],
(srv_config['backlog_main'] if 'backlog_main' in srv_config else srv_options['backlog']['def']),
(False)
)]
sorry for the late reply, yes with this fix now it is working.
but I belive I have to reapply this fix everytime a new version of this pykms_Server.py file will be committed.
Yes you have, because it just disabled the port reusing condition-less. But I have no idea, why the current version is not working, because... Well, it should!
@muhammetunal you said that old versions were working, but you refer versions before 328dced ? (if yes you're right they work for you, SO_REUSEPORT is disabled) After that i kept SO_REUSEPORT always enabled (and only now you can choose !!).
class KeyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
daemon_threads = True
allow_reuse_address = True
@SystemRage Yes you are right working class is keyserver, and not keyserverhandler. and It is working with the @Simonmicro 's fix so I can close the case. thank you for your helps :)
would it be possible that cause might be my server also has an windows linux subsystem (but I am running this application on native windows python subsystem.) because it enables virtualization somehow.
in windows 2016 server when I run this code
PS C:\python> C:\Python\python.exe C:\Python\py-kms\pykms_Server.py [7m[91m[1mSO_REUSEPORT not supported on this platform. Exiting...[0m
I got above error,
but when I run it with parameters as below (I learned it from the png file that systemrage sent for implying color issues)
PS C:\Python> C:\Python\python.exe C:\Python\py-kms\pykms_Server.py connect -u [97m
[93mServer received RPC Bind Request !!! [0m[97m<===============[0m
[93mServer parsing RPC Bind Request...[0m
[93mServer generating RPC Bind Response...[0m
It is working
Now here my question: I use the code below from tutorial to create a service but it is notworking as of now. I tried to add the "connect -u" parameter, but couldnt success in that either, is it really necassary the "connect -u" parameter in order so start the server? or is there any other way that I am missing. note that Old versions were working without any parameters so the code below was working.
import win32serviceutil import win32service import win32event import servicemanager import socket import subprocess
class AppServerSvc (win32serviceutil.ServiceFramework): _svcname = "py-kms" _svc_displayname = "py-kms" _proc = None _cmd = ["C:\Python\python.exe", "C:\Python\py-kms\pykms_Server.py"]
if name == 'main': win32serviceutil.HandleCommandLine(AppServerSvc)