> ## Documentation Index
> Fetch the complete documentation index at: https://sensei.aisbirnusantara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Port Allocation & Networking

> Understanding IP addresses, primary ports, and binding application ports in Pterodactyl

Each server on Aisbir Cloud receives a dedicated IP address and port allocation to allow inbound connections over the internet.

***

### 1. Viewing Server Port Allocations

1. Open your server in the panel and click the **Network** tab.
2. You will see:
   * **IP Alias / Node IP**: The public IP address of the node hosting your container (e.g. `103.xx.xx.xx`).
   * **Port**: The unique port number assigned to your server (e.g. `25565` or `8080`).
   * **Primary Allocation**: The default port mapped to the `SERVER_PORT` environment variable.

***

### 2. Dynamic Port Binding in Application Code

To ensure your web app or API binds properly without `EADDRINUSE` errors, always read dynamic port environment variables and listen on `0.0.0.0`:

<Tabs>
  <Tab title="Node.js (Express)">
    ```javascript theme={null}
    const express = require('express');
    const app = express();

    // Automatically reads Pterodactyl allocated port
    const PORT = process.env.SERVER_PORT || process.env.PORT || 3000;

    app.get('/', (req, res) => {
      res.send('Server Running on Aisbir Cloud!');
    });

    app.listen(PORT, '0.0.0.0', () => {
      console.log(`Server listening on port ${PORT}`);
    });
    ```
  </Tab>

  <Tab title="Python (Flask)">
    ```python theme={null}
    import os
    from flask import Flask

    app = Flask(__name__)

    @app.route('/')
    def home():
        return "Server Running on Aisbir Cloud!"

    if __name__ == '__main__':
        port = int(os.environ.get("SERVER_PORT", 8080))
        app.run(host='0.0.0.0', port=port)
    ```
  </Tab>
</Tabs>
