Message127326
| Author |
rosslagerwall |
| Recipients |
anacrolix, giampaolo.rodola, loewis, pitrou, rosslagerwall |
| Date |
2011年01月28日.19:30:17 |
| SpamBayes Score |
8.3779305e-05 |
| Marked as misclassified |
No |
| Message-id |
<1296243019.29.0.705659875038.issue10882@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Attached is an updated patch that uses keyword arguments.
Using an offset with Linux was always supported although I have cleaned up the documentation a bit to make that clearer.
E.g. the following script sends part of a file over a socket (shows using an offset and None).
This requires listening with a socket on the same computer on port 8001 (e.g. nc -l 8001).
import os
import socket
with open("/tmp/test", "wb") as fp:
fp.write(b"testdata\n" * 1000000)
cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cli.connect(('localhost', 8010))
c = cli.fileno()
f = os.open("/tmp/test", os.O_RDONLY)
os.sendfile(c, f, 1, 7) # "estdata"
cli.send(b"\n\n")
os.sendfile(c, f, None, 4) # "test"
cli.send(b"\n\n")
os.sendfile(c, f, None, 4) # "data"
cli.send(b"\n\n") |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年01月28日 19:30:19 | rosslagerwall | set | recipients:
+ rosslagerwall, loewis, pitrou, giampaolo.rodola, anacrolix |
| 2011年01月28日 19:30:19 | rosslagerwall | set | messageid: <1296243019.29.0.705659875038.issue10882@psf.upfronthosting.co.za> |
| 2011年01月28日 19:30:17 | rosslagerwall | link | issue10882 messages |
| 2011年01月28日 19:30:17 | rosslagerwall | create |
|