---
title: "2 bytes gone in receiving window size"
url: "https://maker.wiznet.io/forum/14660"
markdown_url: "https://maker.wiznet.io/forum/14660/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "jef"
created: "2022-09-27T12:50:20+09:00"
last_activity: "2022-09-27T13:43:29+09:00"
language: "en"
views: 313
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# 2 bytes gone in receiving window size

## Question

Asked by jef on 2022-09-27 in Ethernet Chips.

Sn_MR(ALIGN) = 0
Sn_MR(protocol) = TCP
receive buffer size is 8k.
When I receive TCP data (PC to W5300) the window size updates with the ack.
But with every TCP packet the window size decreases with packet size + 2 bytes.
That would be correct if align was 1 (packet info is 2 bytes).

image provided:
PC is 2.121.10.50
W5300 is 2.121.17.1
Packet send is 1514 bytes on wire, 1460 in payload.
window size is 880 after auto ack from W5300.
After reading the data I sent a dummy byte and window size increases to 2342 (880+1460+2???)
the same goes the other way as well.
The problem is when the PC sends the last 880 bytes, but W5300 can only accept 878 bytes.

[![image](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/2/2f598d590c968ccae62db0818cfa04cb69b28e80.png) image828×173 6.82 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/2/2f598d590c968ccae62db0818cfa04cb69b28e80.png)

I read the datasize from RSR register and there are no 2 bytes as header when i read the FIFO.

other info:
internal phy mode
16 bit data and direct address mode

## Replies

### Reply 1 by Eugeny, 2022-09-27

Datasheet says in 5.2.1.1:

> TCP data is composed of PACKET-INFO and DATA packet in case of Sn_MR(ALIGN)=‘0’.
> In case of Sn_MR(ALIGN) = ‘1’, TCP data has only DATA packet by removing PACKET-INFO.

Therefore you have ALIGN bit set to 0, and have data size as first 2 bytes in the RX buffer before the data. And therefore you must ‘remove’ `datasize+2` bytes from the RX buffer.

---

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