# SetMsgBody

### int SetMsgBody(int lMsgId, byte\[] pnMsg, int nSize)

지정한 메시지 ID(`lMsgId`)에 대해 실제 전송할 데이터 본문(Payload)을 바이트 배열 형태로 설정합니다. 이 함수는 주로 구조화된 리스트 형식이 아닌, 통째로 넘겨야 하는 이진 데이터나 대용량 텍스트 데이터를 처리할 때 유용합니다.

Parameters

<table data-header-hidden><thead><tr><th width="243"></th><th width="113"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td>lMsgId</td><td>int</td><td>본문 데이터를 설정할 대상 메시지 ID</td></tr><tr><td>pnMsg</td><td>byte[]</td><td>설정할 데이터가 담긴 바이트 배열</td></tr><tr><td>nSize</td><td>int</td><td>설정할 데이터의 크기 (바이트 단위)</td></tr></tbody></table>

```csharp
void SendRecipeBinary(int lMsgId, byte[] recipeData)
{
    // 1. 헤더 설정이 완료된 상태에서 Body 데이터 주입
    int dataSize = recipeData.Length;
    
    int result = m_gem.SetMsgBody(lMsgId, recipeData, dataSize);

    if (result >= 0)
    {
        // 2. 바디 설정 성공, 메시지 전송
        m_gem.SendMsg(lMsgId);
        Console.WriteLine($"{dataSize} 바이트의 바디 설정 완료");
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/undefined-6/setmsgbody.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
