Hi
Im trying to figure out why the same server script I
use is running slower in Windows than in Linux.
ServerTest.py:
#! /usr/bin/env python
import SocketServer
from SimpleXMLRPCSer ver import *
import xmlrpclib
class Metode:
def __init__(self):
self.nilai = 0
def ambil(self):
self.nilai += 1
return self.nilai
def terima(self, NilaiBaru):
return xmlrpclib.True
class ServerTest(Sock etServer.Thread ingMixIn,
SimpleXMLRPCSer ver):
pass
server = ServerTest(('19 2.168.1.108', 7777))
server.register _instance(Metod e())
server.serve_fo rever()
I also notice that the threading in Windows only the
MainThread even when multiple clients are accessing
the server. So I assume only 1 thread is being
processed.
ClientTest.py:
#! /usr/bin/env python
import xmlrpclib
BilPrima = 0
conn = xmlrpclib.Serve r("http://192.168.1.108:7 777")
def prima(x):
global BilPrima
for TestFactor in range(2, x):
if (x % TestFactor == 0):
break
elif (TestFactor != x - 1):
continue
else:
BilPrima = x
return BilPrima
while(1):
nilai = conn.ambil()
if nilai <= 1000000:
temp = prima(nilai)
if temp == None:
continue
else:
print temp
conn.terima(tem p)
else:
break
thanks
danu
_______________ _______________ ____
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
Im trying to figure out why the same server script I
use is running slower in Windows than in Linux.
ServerTest.py:
#! /usr/bin/env python
import SocketServer
from SimpleXMLRPCSer ver import *
import xmlrpclib
class Metode:
def __init__(self):
self.nilai = 0
def ambil(self):
self.nilai += 1
return self.nilai
def terima(self, NilaiBaru):
return xmlrpclib.True
class ServerTest(Sock etServer.Thread ingMixIn,
SimpleXMLRPCSer ver):
pass
server = ServerTest(('19 2.168.1.108', 7777))
server.register _instance(Metod e())
server.serve_fo rever()
I also notice that the threading in Windows only the
MainThread even when multiple clients are accessing
the server. So I assume only 1 thread is being
processed.
ClientTest.py:
#! /usr/bin/env python
import xmlrpclib
BilPrima = 0
conn = xmlrpclib.Serve r("http://192.168.1.108:7 777")
def prima(x):
global BilPrima
for TestFactor in range(2, x):
if (x % TestFactor == 0):
break
elif (TestFactor != x - 1):
continue
else:
BilPrima = x
return BilPrima
while(1):
nilai = conn.ambil()
if nilai <= 1000000:
temp = prima(nilai)
if temp == None:
continue
else:
print temp
conn.terima(tem p)
else:
break
thanks
danu
_______________ _______________ ____
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.