D
danu kusmana
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 SimpleXMLRPCServer 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(SocketServer.ThreadingMixIn,
SimpleXMLRPCServer):
pass
server = ServerTest(('192.168.1.108', 7777))
server.register_instance(Metode())
server.serve_forever()
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.Server("http://192.168.1.108:7777")
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(temp)
else:
break
thanks
danu
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
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 SimpleXMLRPCServer 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(SocketServer.ThreadingMixIn,
SimpleXMLRPCServer):
pass
server = ServerTest(('192.168.1.108', 7777))
server.register_instance(Metode())
server.serve_forever()
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.Server("http://192.168.1.108:7777")
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(temp)
else:
break
thanks
danu
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/