Overview
Comment: | Implement -[atEndOfStream] for OFSocket. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
41d7910a654cff468680a3e1c5448a3e |
User & Date: | js on 2009-06-09 13:10:44 |
Other Links: | manifest | tags |
Context
2009-06-09
| ||
13:21 | Handle reads with a returned size of 0 safely in -[readLine]. check-in: b464ddcda5 user: js tags: trunk | |
13:10 | Implement -[atEndOfStream] for OFSocket. check-in: 41d7910a65 user: js tags: trunk | |
13:01 | Use #import "*.h" instead of #import <*.h> in objfw.h. check-in: b7cd1e3dc6 user: js tags: trunk | |
Changes
Modified src/OFSocket.h from [ddb40125e5] to [2c2229f73b].
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #ifndef _WIN32 int sock; #else SOCKET sock; #endif struct sockaddr *saddr; socklen_t saddr_len; } /** * \return A new autoreleased OFTCPSocket */ + socket; | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #ifndef _WIN32 int sock; #else SOCKET sock; #endif struct sockaddr *saddr; socklen_t saddr_len; BOOL eos; } /** * \return A new autoreleased OFTCPSocket */ + socket; |
︙ | ︙ |
Modified src/OFSocket.m from [4843a4b3cd] to [e3b5644b59].
︙ | ︙ | |||
48 49 50 51 52 53 54 | saddr = NULL; return self; } - (BOOL)atEndOfStream { | < < | | | < < < | < | > > < | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | saddr = NULL; return self; } - (BOOL)atEndOfStream { return eos; } - (size_t)readNBytes: (size_t)size intoBuffer: (char*)buf { ssize_t ret; if (sock == INVALID_SOCKET || eos) @throw [OFNotConnectedException newWithClass: isa]; if ((ret = recv(sock, buf, size, 0)) < 0) @throw [OFReadFailedException newWithClass: isa]; if (ret == 0) eos = YES; return ret; } - (size_t)writeNBytes: (size_t)size fromBuffer: (const char*)buf { ssize_t ret; |
︙ | ︙ |