mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
listen(0) -> listen(1) for Solaris 2
This commit is contained in:
parent
749908b9b6
commit
b5f2714e94
1 changed files with 7 additions and 7 deletions
|
@ -45,7 +45,7 @@ def server():
|
||||||
port = MY_PORT
|
port = MY_PORT
|
||||||
s = socket(AF_INET, SOCK_STREAM)
|
s = socket(AF_INET, SOCK_STREAM)
|
||||||
s.bind('', port)
|
s.bind('', port)
|
||||||
s.listen(0)
|
s.listen(1)
|
||||||
print 'Server ready...'
|
print 'Server ready...'
|
||||||
while 1:
|
while 1:
|
||||||
conn, (host, remoteport) = s.accept()
|
conn, (host, remoteport) = s.accept()
|
||||||
|
@ -69,24 +69,24 @@ def client():
|
||||||
else:
|
else:
|
||||||
port = MY_PORT
|
port = MY_PORT
|
||||||
testdata = 'x' * (BUFSIZE-1) + '\n'
|
testdata = 'x' * (BUFSIZE-1) + '\n'
|
||||||
t1 = time.millitimer()
|
t1 = time.time()
|
||||||
s = socket(AF_INET, SOCK_STREAM)
|
s = socket(AF_INET, SOCK_STREAM)
|
||||||
t2 = time.millitimer()
|
t2 = time.time()
|
||||||
s.connect(host, port)
|
s.connect(host, port)
|
||||||
t3 = time.millitimer()
|
t3 = time.time()
|
||||||
i = 0
|
i = 0
|
||||||
while i < count:
|
while i < count:
|
||||||
i = i+1
|
i = i+1
|
||||||
s.send(testdata)
|
s.send(testdata)
|
||||||
s.shutdown(1) # Send EOF
|
s.shutdown(1) # Send EOF
|
||||||
t4 = time.millitimer()
|
t4 = time.time()
|
||||||
data = s.recv(BUFSIZE)
|
data = s.recv(BUFSIZE)
|
||||||
t5 = time.millitimer()
|
t5 = time.time()
|
||||||
print data
|
print data
|
||||||
print 'Raw timers:', t1, t2, t3, t4, t5
|
print 'Raw timers:', t1, t2, t3, t4, t5
|
||||||
print 'Intervals:', t2-t1, t3-t2, t4-t3, t5-t4
|
print 'Intervals:', t2-t1, t3-t2, t4-t3, t5-t4
|
||||||
print 'Total:', t5-t1
|
print 'Total:', t5-t1
|
||||||
print 'Throughput:', int(float(BUFSIZE*count) / float(t5-t1)),
|
print 'Throughput:', round((BUFSIZE*count*0.001) / (t5-t1), 3),
|
||||||
print 'K/sec.'
|
print 'K/sec.'
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue