OLD | NEW |
| (Empty) |
1 # Copyright (c) 2008 Twisted Matrix Laboratories. | |
2 # See LICENSE for details. | |
3 | |
4 | |
5 def send(long s, object buff, object obj, unsigned long flags = 0): | |
6 cdef int rc | |
7 cdef myOVERLAPPED *ov | |
8 cdef WSABUF ws_buf | |
9 cdef unsigned long bytes | |
10 | |
11 PyObject_AsReadBuffer(buff, <void **>&ws_buf.buf, <int *>&ws_buf.len) | |
12 | |
13 ov = makeOV() | |
14 if obj is not None: | |
15 ov.obj = <PyObject *>obj | |
16 | |
17 rc = WSASend(s, &ws_buf, 1, &bytes, flags, <OVERLAPPED *>ov, NULL) | |
18 | |
19 if rc == SOCKET_ERROR: | |
20 rc = WSAGetLastError() | |
21 if rc != ERROR_IO_PENDING: | |
22 return rc, bytes | |
23 | |
24 Py_XINCREF(obj) | |
25 return rc, bytes | |
26 | |
27 | |
OLD | NEW |