I have a program that recevice message in udp in visual studio.

sometime I miss a message.I want to use select to see udp buffer used size if udp rec buffer is full.

How I can use select for this purpose?

where can I see a example?
['https://Stackoverflow.com/questions/12803508', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/598470/']
Post-fact discovery that your receive buffer is full will not do you any good - packets have already been dropped. Even more - you need to set your buffer sizes before `connect()` or `bind()`, they will not change after that.

What you should do is pre-set socket receive buffer to some large value that would accommodate your traffic spikes, and try to process your network input faster. That usually means doing `select()` on non-blocking sockets (or even better - some advanced API like Linux `epoll(7)` in edge-triggered mode), and draining socket input until you get `EWOULDBLOCK`.

### Edit 0:

You cannot discover that you missed a UDP packet by using `select()` or any other socket API. This has to be done in the **application-level protocol**, i.e. one layer up from the transport. Common practice is including sequence numbers in application message header.
You can use [`getsockopt`](http://linux.die.net/man/3/getsockopt) to get socket options, including receive buffer size. Use [`setsockopt`](http://linux.die.net/man/3/setsockopt) to set the size.

Example of getting the size:

```
int size;
getsockopt(socket_fd, SOL_SOCKET, SO_RCVBUF, &size);
std::cout << "Buffer size is currently " << size << " bytes\n";

```