> For the complete documentation index, see [llms.txt](https://nviasoft.gitbook.io/nviasoft-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getmsginfo.md).

# GetMsgInfo

### int GetMsgInfo(int lMsgId, ref short nStream, ref short nFunction, ref short nWait, ref int nLength)

GetMsgInfo 함수는 **수신된** SECS 메시지의 헤더 정보를 추출할 때 사용합니다. 메시지의 Stream(S), Function(F), Wait Bit(W) 그리고 \*\*전체 메시지 길이(Length)\*\*를 한 번에 확인할 수 있어, 메시지 수신 후 어떤 로직으로 분기할지 결정하는 가장 기초적이면서도 중요한 함수입니다.

{% hint style="info" %}
OnMsgReceived() 함수에서 Stream,Function 별로 처리할 때 사용합니다.
{% endhint %}

Parameters

<table data-header-hidden><thead><tr><th width="149" valign="top"></th><th width="122" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Name</td><td valign="top">Type</td><td valign="top">Description</td></tr><tr><td valign="top">lMsgId</td><td valign="top">int</td><td valign="top">수신한 Message의 ID</td></tr><tr><td valign="top">nStream</td><td valign="top">ref short</td><td valign="top">수신한 SECS 메시지의 Stream</td></tr><tr><td valign="top">nFunction</td><td valign="top">ref short</td><td valign="top">수신한 SECS 메시지의 Function</td></tr><tr><td valign="top">nWait</td><td valign="top">ref short</td><td valign="top">수신한 SECS 메시지의 Wbit</td></tr><tr><td valign="top">nLength</td><td valign="top">ref int</td><td valign="top">수신한 SECS 메시지의 length</td></tr></tbody></table>

```csharp
short nStream = 0;
    short nFunction = 0;
    short nWait = 0;
    int nLength = 0;

    // 1. 메시지 정보 추출
int nResult = m_gem.GetMsgInfo(lMsgId, ref nStream, ref nFunction, ref nWait, ref nLength);

if (nResult >= 0)
{
Console.WriteLine($"메시지 정보 - S{nStream}F{nFunction}, Wait:{nWait}, Length:{nLength}");

// 2. Stream/Function에 따른 로직 분기
if (nStream == 1 && nFunction == 1)
{
    // S1F1 (Are You There?) 처리
   ProcessS1F1(lMsgId);
}
else if (nStream == 2 && nFunction == 41)
{
    // S2F41 (Remote Command) 처리
    ProcessS2F41(lMsgId);
}
}
```


---

# 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/item-parsing/getmsginfo.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.
