---
title: "TCP receive process - data length"
url: "https://maker.wiznet.io/forum/10306"
markdown_url: "https://maker.wiznet.io/forum/10306/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "mboehmer"
created: "2014-06-15T22:50:08+09:00"
last_activity: "2017-05-04T08:33:09+09:00"
language: "en"
views: 1823
replies: 2
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# TCP receive process - data length

## Question

Asked by mboehmer on 2014-06-15 in Ethernet Chips.

Hi,

as changing code from W5300 to W5500 one question is arising: I miss data format description in datasheet. For W5300 there was datalength present in buffer before payload, for W5500 there is no information on that issue.
Only for IPRAW I found some information in application note.
In case of UDP (as used for DHCP) this will also be an issue.

From hexdump of first received packet of HTTP GET I can only assume the Sn_RX_RSR contains the payload length of received packet in case of TCP socket. Is this correct?

What happens in case of big socket RX buffer? In that case (HTTP upload) several packets may get received at once in buffer, so will Sn_RX_RSR show the payload size of first packet received only, or the total sum of payloads of packets already received (difference between Sn_RX_RD and Sn_RX_WR)?

Some clarification would really be helpful. Someone from WizNet, maybe?

Michael

## Replies

### Reply 1 by suhwan, 2014-06-15

Dear Michael,

> n case of UDP (as used for DHCP) this will also be an issue.

=> In cast of UDP, Packet frame is as below
|-- Destination IP Address (4bytes) --|-- Destiantion Port number (2bytes) --|-- Payload length (2bytes) --|

> From hexdump of first received packet of HTTP GET I can only assume the Sn_RX_RSR contains the payload length of received packet in case of TCP socket. Is this correct?

=> Your understand is correct.

> What happens in case of big socket RX buffer? In that case (HTTP upload) several packets may get received at once in buffer, so will Sn_RX_RSR show the payload size of first packet received only, or the total sum of payloads of packets already received (difference between Sn_RX_RD and Sn_RX_WR)?

=> Socket Received Size register represents the received data length in socket rx buffer.
So, Sn_RSR indicates the total sum of payloads of packets

Thanks,

### Reply 2 by mboehmer, 2014-06-15

[quote]=> Socket Received Size register represents the received data length in socket rx buffer.
So, Sn_RSR indicates the total sum of payloads of packets[/quote]

So there is no way of finding out the size of different received packets inside the RX buffer?

Michael

---

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