---
title: "A question about RECV command in S0_CR register"
url: "https://maker.wiznet.io/forum/11910"
markdown_url: "https://maker.wiznet.io/forum/11910/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Watercub3"
created: "2016-08-29T06:37:02+09:00"
last_activity: "2017-05-04T08:39:03+09:00"
language: "en"
views: 673
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# A question about RECV command in S0_CR register

## Question

Asked by Watercub3 on 2016-08-29 in Ethernet Chips.

Hello.
I don’t quite understand the way of using RECV command in S0_CR register.
Suppose there are 1000 bytes of data in the internal RX memory, but I only want to extract 256 bytes of data for now. So, when is the proper time to send RECV command? Is it just after extracting 256 bytes of data? Or perhaps it has to be the time when all the 1000 bytes are extracted?
Thanks.

## Replies

### Reply 1 by Eugeny, 2016-09-12

Read W5100’s datasheet on the algorithms and how to handle buffers.

![](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/48.png) Watercub3:

> So, when is the proper time to send RECV command?

Any time can be proper time for application. If there’s free space in RX buffer, incoming data will be placed into the buffer. If there’s no space in the buffer, then RECV will do nothing. Thus it is in your interest to free buffer as quick as possible.

![](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/48.png) Watercub3:

> Is it just after extracting 256 bytes of data?

You can extract byte count less than currently indicated by received data size, and you should set new pointer accordingly (+256 bytes). Then, if you issue RECV command, those 256 byte space will be considered as “free” for new data.

![](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/48.png) Watercub3:

> Or perhaps it has to be the time when all the 1000 bytes are extracted?

Again, keeping data in the buffer you risk to miss new data (in case of UDP). But generally you can extract by 1 byte, and every time use RECV command to receive one further byte. Also keep in mind that it is a killer from performance perspective. The bigger size of data you move and “free”, the faster everything works.

---

Source: https://maker.wiznet.io/forum/11910
