|
12 | 12 | data ='initialised...' |
13 | 13 | input_ = [server_socket] |
14 | 14 | output = [server_socket] |
15 | | -inputready,outputready,exceptready = select.select(input_,output,[]) |
16 | | -print len(inputready) , len(input_), len(outputready), len(output) |
17 | | -while 1: |
| 15 | + |
| 16 | +while 1: |
| 17 | + inputready,outputready,exceptready = select.select(input_,output,[]) |
| 18 | + print len(inputready) , len(input_), len(outputready), len(output) |
| 19 | + |
18 | 20 | for s in inputready: |
19 | 21 | if s==server_socket: |
20 | 22 | client, address = server_socket.accept() |
|
23 | 25 |
|
24 | 26 | else: |
25 | 27 | if data: |
26 | | - s.send(data) |
| 28 | + s.send(data) |
27 | 29 | data=s.recv(1024) |
28 | 30 | print "received:",data |
29 | 31 | if data: |
30 | 32 | print "out of inputready" |
31 | 33 | break; |
32 | 34 | else: |
33 | 35 | input_.remove(s) |
34 | | - inputready,outputready,exceptready = select.select(input_,output,[]) |
35 | | - print len(inputready) , len(input_), len(outputready), len(output) |
36 | 36 | inputready,outputready,exceptready = select.select(input_,output,[]) |
37 | 37 | print len(inputready) , len(input_), len(outputready), len(output) |
38 | 38 | for s in outputready: |
|
48 | 48 | s.close() |
49 | 49 | inputready,outputready,exceptready = select.select(input_,output,[]) |
50 | 50 | print len(inputready) , len(input_), len(outputready), len(output) |
| 51 | + data='' |
51 | 52 |
|
52 | 53 |
|
0 commit comments