File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -41,18 +41,18 @@ with NPopen('r+') as pipe: # bidirectional (duplex) binary pipe
41
41
stream = pipe.wait()
42
42
43
43
# 4. Perform read/write operation with stream (or pipe.stream) as a file-like object
44
- b = stream.read(64 )
45
- b = pipe.stream.read(64 ) # alternate
44
+ b = stream.read(64 ) # read 64 bytes from the client
45
+ b = pipe.stream.read(64 ) # same call but using the stream property
46
46
47
47
in_bytes = bytearray (128 )
48
- nread = stream.readinto(in_bytes)
48
+ nread = stream.readinto(in_bytes) # read 128 bytes of data from client and place them in in_bytes
49
49
50
- b_rest = stream.readall()
50
+ b_rest = stream.readall() # read all bytes sent by the client, block till client closes the pipe
51
51
52
- stream.write(out_bytes)
52
+ stream.write(out_bytes) # send bytes in out_bytes to the client
53
53
54
54
# 5. the stream is automatically closed and the pipe object is destroyed
55
- # when comes out of the contenxt
55
+ # when comes out of the context
56
56
```
57
57
58
58
## API Reference
You can’t perform that action at this time.
0 commit comments