---
name: "CL_Network"
section: "3"
platform: "linux"
package: "clanlib0-common-dev"
version: "0.4.4-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/CL_Network"
---

# CL\_Network(3)

Network component class. Starting place for all net activity in ClanLib.

## NAME

CL\_Network - Network component class. Starting place for all net activity in ClanLib.

## CLASS MEMBERS

- static void **find\_games\_broadcast**(

  ```
   std::string game_id,
  int port)
  ```

- static void **find\_game\_at**(

  ```
   std::string game_id,
  const char *host_address,
  int port)
  ```

- static bool **peek\_game\_found**()

  - static CL\_NetGame \***receive\_game\_found**(

  ```
  int timeout_millis)
  ```

- static void **clear\_games\_found**()

  - static CL\_NetGame \***create\_game**(

  ```
   std::string game_id,
  int port)
  ```

## MEMBERS WITH DESCRIPTIONS

- static void **find\_games\_broadcast**(

  ```
   std::string game_id,
  int port)
  ```

  ```
  Parameters:
  game_id - The game's ID used to locate this type of game with.
  port - Broadcast UDP port.
  ```

  ```
  Description:
  ```

  Searchs for games using UDP broadcasting at the specified *port*. Only games with the same *game\_id* are added to CL\_Network::netgames.

- static void **find\_game\_at**(

  ```
   std::string game_id,
  const char *host_address,
  int port)
  ```

  ```
  Parameters:
  host_address - IP address or hostname of the computer to be contacted.
  port - Port which the computer contacted listens on.
  ```

  ```
  Description:
  ```

  Searchs for games at the specified host address and port (*port*).

- static bool **peek\_game\_found**()

  ```
  Description:
  ```

  Returns true if any netgames have been found. Use receive\_game\_found() toget the individual games found.

  ```
  Return value:
  ```

  True if any netgames have been found.

- static CL\_NetGame \***receive\_game\_found**(

  ```
  int timeout_millis)
  ```

  ```
  Parameters:
  timeout_millis - Timeout before returning if no game was found.
  ```

  ```
  Description:
  ```

  Returns the first netgame found. It is then removed from the list of gamesfound. Next time it is called it will return the next in available. The function is blocking until the specified timeout runs out.If set to zero, it will block forever until a game has been found.Remember to delete the netgame returned after usage.

  ```
  Return value:
  ```

  The netgame found, or NULL if timed out. Remember to delete the netgame after usage.

- static void **clear\_games\_found**()

  ```
  Description:
  ```

  Clears the list of games found.

- static CL\_NetGame \***create\_game**(

  ```
   std::string game_id,
  int port)
  ```

  ```
  Parameters:
  game_id - The game ID is used to locate netgames of the same type.
  port - Port the game accepts connections on - and listens for broadcasts.
  ```

  ```
  Description:
  ```

  Creates a new network game.

  ```
  Return value:
  ```

  The created network game.

## SEE ALSO

All ClanLib API classes can be found in **clanlib (3)**.

## AUTHORS

Originally written by Magnus Norddahl \<*mbn@dark.x.dtu.dk*\> and Martin Starch \<*starch@dark.x.dtu.dk*\>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at **http://somewhere.in.the.world.org**).

See **clanlib (3)** to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.
