#include <DatagramSocket.h>
Inheritance diagram for DatagramSocket:
Public Member Functions | |
DatagramSocket (RefCountedSocketFactory *factory, MNSelector &sel, MNSocket &sock) | |
DatagramSocket (RefCountedSocketFactory *factory, MNSelector &sel, int port) | |
virtual | ~DatagramSocket () |
virtual void | activate (bool sender) |
virtual void | tcp_callback (MNSelector *select, int fd) |
virtual void | write_enabled () |
iovec * | set_buffers_tcp (int &iovlen, int &buffersize) |
void | buffers_to_rope_tcp (struct iovec *iov, int &iovlen, size_t bytesused) |
Public Attributes | |
MNSocketBaseT< DatagramSocket > | _callmeplease |
MNSocketBaseT< DatagramSocket > | _callmepleasewrite |
The DatagramSocket class is used for streaming over TCP. When a tcp rtp-socket receives data, the MNSelector will via MNSocketBase call the funtion "tcp_callback" in this class instead of the regular "callback" function. This class will take care of reading from tcp-buffers so that we "fake" a datagram receive. The tcp_callback will first read 5 bytes containing the size of the upcoming rtp-packet. It then reads this size from the tcp-buffer and calls the reader() function.
|
|
|
|
|
|
|
|
|
The function will not create a new rope and add leafs to it. Instead the rope is created as a member variabel and we add leafs to it until the recvmsg(s) has received the whole tcp-packet. After the packet is totally received, reader() is called and a new MNRope is againg created. |
|
The function will create a simple iovec buffer, where the size comes from the first 5 bytes read on the socket. |
|
The specialized tcp-callback function which is called when the selector notices new incoming data on the tcp socket. |
|
The function is called when the selector notices that the send buffer is not full anymore On lines with heavy traffic TCP may not be able to send as much data as wanted. In such cases the TCP socket runs full, and we will have to store not sent RTP data on an application queue. When the write_enabled function is called, the application can try to send more rtp data to the socket. Reimplemented from MNSocketBase.
|
|
|
|
|