# Compile and run the sample project (/en/realtime-media/rtc-server-sdk/build/set-up-your-project/compile-run-sample-project)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Agora provides a runnable sample project with the Server Gateway SDK. This page shows you how to run the sample project to send and receive media streams.

## Get the sample project

[Download](/en/api-reference/sdks?product=server-gateway\&platform=linux) the latest x86-64 SDK package and decompress the file. If you need the SDK build for other architectures, [submit a ticket](https://agora-ticket.agora.io/) to technical support.

## Compile the sample project

Run the following commands to compile the sample project:

```bash
# Switch to the sample project folder
cd agora_rtc_sdk/example
# Build the sample project
./build-x86_64.sh
# Sync and video/audio data needed by the project
cd out
../sync-data.sh
# Export the libraries from the SDK to LD_LIBRARY_PATH
export LD_LIBRARY_PATH=../../agora_sdk:$LD_LIBRARY_PATH
```

## Send media streams from the server

This section uses the `sample_send_h264_pcm` project to demonstrate sending media streams from the server.

### Run the sample

Run the following command to execute the `sample_send_h264_pcm` sample project.

```bash
# Run sample_send_h264_pcm to send video in H.264 format and audio in PCM format
./sample_send_h264_pcm --token YOUR_RTC_TOKEN --channelId demo_channel --videoFile test_data/send_video.h264 --audioFile test_data/send_audio_16k_1ch.pcm
```

Replace the parameter value of `--token`, with your RTC SDK temporary token. Replace the parameter value of `--channelId` with the value of your RTC SDK channel ID.

<CalloutContainer type="info">
  <CalloutDescription>
    Use the same RTC SDK channel ID that you used to generate the temporary token.
  </CalloutDescription>
</CalloutContainer>

### Use the web demo to receive streams sent from the server

To simulate a client receiving data in a browser, use the Agora Web demo.

1. Use a PC or mobile device to open the [Agora RTC SDK Web SDK sample project](https://webdemo.agora.io/basicVideoCall/index.html) and fill in the following fields:

   * **APP ID**：Specify your Agora app ID. The ID must be the same as the one you used for your server.
   * **Channel Name**：Specify the same channel name you used for the server.
   * **Token**: Specify a valid RTC SDK temporary token.

2. Click **Join** to receive media streams from the server.

   ![Agora Web demo receiving media streams](https://web-cdn.agora.io/docs-files/1650527522676)

## Receive media streams from the client

This section  uses the `sample_receive_h264_pcm` project to demonstrate receiving media streams from the client.

### Run the sample

Run the following command to launch the `sample_receive_h264_pcm` project.

```bash
# Run sample_receive_h264_pcm to receive video in H.264 format and audio in PCM format
./sample_receive_h264_pcm --token YOUR_RTC_TOKEN --channelId demo_channel
```

Replace the parameter value of `--token`, with your RTC SDK temporary token. Replace the parameter value of `--channelId` with the value of your RTC SDK channel ID.

When the sample project is running, the console outputs the following information:

```text
[ APP_LOG_INFO ] Subscribe streams from all remote users
[ APP_LOG_INFO ] Start receiving audio & video data ...
[ APP_LOG_INFO ] Created file received_audio.pcm to save received PCM samples
[ APP_LOG_INFO ] onUserAudioTrackStateChanged: userId 4088243221, state 1, reason 0
[ APP_LOG_INFO ] onUserAudioTrackStateChanged: userId 4088243221, state 2, reason 6
[ APP_LOG_INFO ] onUserInfoUpdated: userId 4088243221, msg 0, val 0
[ APP_LOG_INFO ] onUserInfoUpdated: userId 4088243221, msg 4, val 1
[ APP_LOG_INFO ] onUserInfoUpdated: userId 4088243221, msg 8, val 1
[ APP_LOG_INFO ] onUserInfoUpdated: userId 4088243221, msg 1, val 1
```

### Use the web demo to send media streams to the server

1. Use a PC or mobile device to open the [Agora RTC SDK Web SDK sample project](https://webdemo.agora.io/basicVideoCall/index.html) and specify the following fields:

   * **APP ID**：Specify your Agora app ID. The ID must be the same as the one you used for your server.
   * **Channel Name**：Specify the same channel name you used for the server.
   * **Token**: Specify a valid RTC SDK temporary token.

2. Click **Join** to send media streams to the server.

   When the sample server project is running, the console prints the following information:

   ```text
   [ APP_LOG_INFO ] onUserInfoUpdated: userId 436868190, msg 0, val 1
   [ APP_LOG_INFO ] onUserInfoUpdated: userId 436868190, msg 4, val 1
   [ APP_LOG_INFO ] onUserInfoUpdated: userId 436868190, msg 8, val 1
   [ APP_LOG_INFO ] onUserInfoUpdated: userId 436868190, msg 1, val 1
   [ APP_LOG_INFO ] onUserInfoUpdated: userId 436868190, msg 0, val 0
   [ APP_LOG_INFO ] onUserInfoUpdated: userId 436868190, msg 1, val 0
   [ APP_LOG_INFO ] onUserVideoTrackSubscribed: userId 436868190, codecType 1, encodedFrameOnly 1
   [ APP_LOG_INFO ] onUserAudioTrackStateChanged: userId 436868190, state 1, reason 0
   [ APP_LOG_INFO ] onUserAudioTrackStateChanged: userId 436868190, state 2, reason 6
   [ APP_LOG_INFO ] Created file received_video.h264 to save received H264 frames
   [ APP_LOG_INFO ] onUserAudioTrackStateChanged: userId 436868190, state 0, reason 7
   ```

   The received video and audio data is saved to the `received_video.h264` and `received_audio.pcm` files, respectively.

    
  
      
  
      
  
      
  


## Platform-specific versions
- [Linux C++](/en/realtime-media/rtc-server-sdk/build/set-up-your-project/compile-run-sample-project/linux-cpp.md)
- [Linux Java](/en/realtime-media/rtc-server-sdk/build/set-up-your-project/compile-run-sample-project/linux-java.md)
- [Python](/en/realtime-media/rtc-server-sdk/build/set-up-your-project/compile-run-sample-project/python.md)
- [Go](/en/realtime-media/rtc-server-sdk/build/set-up-your-project/compile-run-sample-project/go.md)
