OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 import "mojo/services/public/interfaces/network/net_address.mojom" | 5 import "mojo/services/public/interfaces/network/net_address.mojom" |
6 import "mojo/services/public/interfaces/network/network_error.mojom" | 6 import "mojo/services/public/interfaces/network/network_error.mojom" |
7 | 7 |
8 module mojo { | 8 module mojo { |
9 | 9 |
10 // UDPSocket and UDPSocketClient represent a UDP socket and its client. The | 10 // UDPSocket and UDPSocketClient represent a UDP socket and its client. The |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // ... | 56 // ... |
57 // service->ReceiveMorePackets(3); | 57 // service->ReceiveMorePackets(3); |
58 // // The client expects 4 more calls to OnReceived(). | 58 // // The client expects 4 more calls to OnReceived(). |
59 ReceiveMorePackets(uint32 number); | 59 ReceiveMorePackets(uint32 number); |
60 | 60 |
61 // Sends data to the specified destination. The socket must be bound. | 61 // Sends data to the specified destination. The socket must be bound. |
62 // The method doesn't report the result of the operation. | 62 // The method doesn't report the result of the operation. |
63 SendToAndForget(NetAddress addr, uint8[] data); | 63 SendToAndForget(NetAddress addr, uint8[] data); |
64 | 64 |
65 // Sends data to the specified destination. The socket must be bound. | 65 // Sends data to the specified destination. The socket must be bound. |
| 66 // On success, |result.code| is a non-negative number indicating how many |
| 67 // bytes have been written. Otherwise, it is a network error code, including |
| 68 // (but not limited to): |
| 69 // - ERR_INSUFFICIENT_RESOURCES (-12): The service doesn't have sufficient |
| 70 // resource to complete the operation. One possible cause is that the client |
| 71 // tries to send too many packets in a short period of time. |
66 SendTo(NetAddress addr, uint8[] data) => (NetworkError result); | 72 SendTo(NetAddress addr, uint8[] data) => (NetworkError result); |
67 }; | 73 }; |
68 | 74 |
69 interface UDPSocketClient { | 75 interface UDPSocketClient { |
70 // |addr| and |data| are non-NULL on success. | 76 // On success, |addr| and |data| are non-NULL, |result.code| is a non-negative |
| 77 // number indicating how many bytes have been received. |
71 OnReceived(NetworkError result, NetAddress? addr, uint8[]? data); | 78 OnReceived(NetworkError result, NetAddress? addr, uint8[]? data); |
72 }; | 79 }; |
73 | 80 |
74 } | 81 } |
OLD | NEW |