---
title: "w5500 data(payload) length"
url: "https://maker.wiznet.io/forum/13699"
markdown_url: "https://maker.wiznet.io/forum/13699/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "cafe820"
created: "2020-02-13T08:41:38+09:00"
last_activity: "2020-02-20T00:51:18+09:00"
language: "ko"
views: 737
replies: 4
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# w5500 data(payload) length

## Question

Asked by cafe820 on 2020-02-13 in Ethernet Chips.

안녕하세요
w5500 사용중인데 한번에 송신/수신 가능한 udp/tcp payload size 문의드립니다.

1. payload size는 소켓에 할당된 메모리 용량만큼 사용가능한지요

2. payload가 mtu 보다 큰 경우 w5500이 자동으로 나누어 보내는지 궁금합니다

감사합니다

## Replies

### Reply 1 by becky, 2020-02-19

1. 맞습니다. 다만 UDP RECV의 경우 패킷당 8byte의 packet info 데이터를 제외하셔야 됩니다.

2. 송신의 경우 w5500이 자동으로 나누어 보내며, 수신의 경우 mtu보다 큰 패킷은 수신하지 못합니다.

### Reply 2 by cafe820, 2020-02-19

MTU 보다 큰 패킷을 수신하지 못한다면
만일 W5500 하나가 MTU 단위로 자동으로 나누어 송신하고 다른 W5500이 수신하는 경우

1. 수신측에서 받는것은 문제가 없는지요

2. 문제가 없다면 수신측에서 여러 파트인지 한 패킷인지 구분하는 기준은 무엇인지요
   질문을 바꾸면 나누어진 패킷을 수신하는 방법에 대한 예제나 샘플이 있는지요

3. 송신부가 W5500이 아닌 같은 MTU를 사용하는 PC나 다른 HOST인 경우에도 2)에서 사용한 방법을
   공통적으로 사용할 수 있는지요

프로젝트 진행에 매우 중요한 문제로 실질적인 솔루션을 주시면 감사하겠습니다

### Reply 3 by becky, 2020-02-19 (in reply to reply 2)

W5500끼리 통신한다면 W5500은 MTU보다 큰 패킷을 전송하지 않기때문에 수신에 문제가 되진 않습니다. TCP의경우 구분하지않으며, UDP의 경우 데이터 수신시 패킷앞에 packet-info가 붙습니다. 이를통해 구분합니다. ioLibrary의 Driver code에서 recvfrom 함수를 참고하시길 바랍니다. image799×209 5.37 KB github.com Wiznet/ioLibrary_Driver/blob/master/Ethernet/socket.c //***************************************************************************** // //! \file socket.c //! \brief SOCKET APIs Implements file. //! \details SOCKET APIs like as Berkeley Socket APIs. //! \version 1.0.3 //! \date 2013/10/21 //! \par Revision history //! &lt;2015/02/05> Notice //! The version history is not updated after this point. //! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. //! >> https://github.com/Wiznet/ioLibrary_Driver //! &lt;2014/05/01> V1.0.3. Refer to M20140501 //! 1. Implicit type casting -> Explicit type casting. //! 2. replace 0x01 with PACK_REMAINED in recvfrom() //! 3. Validation a destination ip in connect() & sendto(): //! It occurs a fatal error on converting unint32 address if uint8* addr parameter is not aligned by 4byte address. //! Copy 4 byte addr value into temporary uint32 variable and then compares it. //! &lt;2013/12/20> V1.0.2 Refer to M20131220 //! Remove Warning. This file has been truncated. show original 3 가능합니다.

### Reply 4 by cafe820, 2020-02-19

becky:

> UDP의 경우 데이터 수신시 패킷앞에 packet-info가 붙습니다. 이를통해 구분합니다.
> ioLibrary의 Driver code에서 recvfrom 함수를 참고하시길 바랍니다.

헤더의 DATA SIZE 2바이트는 함께온 데이터 길이라는것은 이해하고 있습니다.
조금 혼선이 생기는 부분은

1. 현재 패킷이 큰 패킷의 잘려진 일부이므로 합쳐서 사용해야하는지

2. 아니면 독립적으로 전송된 패킷인지를 어떻게 판단할 수 있는지 입니다.

친절하고 빠른 답변에 감사드립니다.

---

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