|
|
| 125 |
:cpp:func:`ns3::Socket::SetSendCallback` callback is invoked. |
125 |
:cpp:func:`ns3::Socket::SetSendCallback` callback is invoked. |
| 126 |
An application can also ask the socket how much space is available |
126 |
An application can also ask the socket how much space is available |
| 127 |
by calling :cpp:func:`ns3::Socket::GetTxAvailable`. A typical sequence |
127 |
by calling :cpp:func:`ns3::Socket::GetTxAvailable`. A typical sequence |
| 128 |
of events for sending data (ignoring connection setup) might be: |
128 |
of events for sending data (ignoring connection setup) might be::: |
| 129 |
|
129 |
|
| 130 |
* ``SetSendCallback (MakeCallback(&HandleSendCallback));`` |
130 |
* ``SetSendCallback (MakeCallback(&HandleSendCallback));`` |
| 131 |
* ``Send ();`` |
131 |
* ``Send ();`` |
| 132 |
* ``Send ();`` |
132 |
* ``Send ();`` |
| 133 |
* ... |
133 |
* ... |
| 134 |
* Send fails because buffer is full |
134 |
* Send fails because buffer is full |
| 135 |
* wait until :cpp:func:`HandleSendCallback` is called |
135 |
* wait until :cpp:func:`HandleSendCallback` is called |
| 136 |
* :cpp:func:`HandleSendCallback` is called by socket, since space now available |
136 |
* :cpp:func:`HandleSendCallback` is called by socket, since space now available |
| 137 |
* ``Send (); // Start sending again`` |
137 |
* ``Send (); // Start sending again`` |
| 138 |
|
138 |
|
| 139 |
Similarly, on the receive side, the socket user does not block on |
139 |
Similarly, on the receive side, the socket user does not block on |
| 140 |
a call to ``recv()``. Instead, the application sets a callback |
140 |
a call to ``recv()``. Instead, the application sets a callback |