OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SOCKET_SOCKET_H_ | 5 #ifndef NET_SOCKET_SOCKET_H_ |
6 #define NET_SOCKET_SOCKET_H_ | 6 #define NET_SOCKET_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
10 #include "net/base/net_api.h" | 10 #include "net/base/net_export.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 class IOBuffer; | 14 class IOBuffer; |
15 | 15 |
16 // Represents a read/write socket. | 16 // Represents a read/write socket. |
17 class NET_API Socket { | 17 class NET_EXPORT Socket { |
18 public: | 18 public: |
19 virtual ~Socket() {} | 19 virtual ~Socket() {} |
20 | 20 |
21 // Reads data, up to |buf_len| bytes, from the socket. The number of bytes | 21 // Reads data, up to |buf_len| bytes, from the socket. The number of bytes |
22 // read is returned, or an error is returned upon failure. | 22 // read is returned, or an error is returned upon failure. |
23 // ERR_SOCKET_NOT_CONNECTED should be returned if the socket is not currently | 23 // ERR_SOCKET_NOT_CONNECTED should be returned if the socket is not currently |
24 // connected. Zero is returned once to indicate end-of-file; the return value | 24 // connected. Zero is returned once to indicate end-of-file; the return value |
25 // of subsequent calls is undefined, and may be OS dependent. ERR_IO_PENDING | 25 // of subsequent calls is undefined, and may be OS dependent. ERR_IO_PENDING |
26 // is returned if the operation could not be completed synchronously, in which | 26 // is returned if the operation could not be completed synchronously, in which |
27 // case the result will be passed to the callback when available. If the | 27 // case the result will be passed to the callback when available. If the |
(...skipping 26 matching lines...) Expand all Loading... |
54 | 54 |
55 // Set the send buffer size (in bytes) for the socket. | 55 // Set the send buffer size (in bytes) for the socket. |
56 // Note: changing this value can affect the TCP window size on some platforms. | 56 // Note: changing this value can affect the TCP window size on some platforms. |
57 // Returns true on success, or false on failure. | 57 // Returns true on success, or false on failure. |
58 virtual bool SetSendBufferSize(int32 size) = 0; | 58 virtual bool SetSendBufferSize(int32 size) = 0; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace net | 61 } // namespace net |
62 | 62 |
63 #endif // NET_SOCKET_SOCKET_H_ | 63 #endif // NET_SOCKET_SOCKET_H_ |
OLD | NEW |