NAME
====
  vg_nw_startserver() - only master: start network-server and connect to it


SYNOPSIS
========
  int vg_nw_startserver(int proto, const char * serv, int ctimo, int ipv, const char * scast, int ptimo)


DESCRIPTION
===========
  Starts the network-server and connects the calling player (master) to it
  internally using the function vg_nw_connect().

  Only the master player has to start the network-server with this function,
  all other players must connect to it via vg_nw_connect().
  Before this function is called, vg_nw_setplayer() has to be called.

  proto is the protocol:
    PROTO_UDP for UDP-packets, not synchronized, that means
      not waiting for each other, which is the default
    PROTO_TCP for TCP-packets, synchronized, that means
      waiting for each other, which is normally not recommended.

  serv is the portnumber or service-string of the server.

  ctimo is the timeout in seconds for waiting for connects.
    If the maximum number of players (set with vg_nw_setplayer()) is not
    reached, the server ends the connecting phase after this timeout.

  ipv is the ip-version: 4=IPv4 or 6=IPv6.

  scast is the portnumber or service-string of the
    broadcast- or multicast-server for the clients getting the ip-address,
    or NULL=don't start broadcast-/multicast-server
    (but then the clients must connect directly to a specific ip-address).

  ptimo is the timeout in seconds for waiting for packets while
    the game is running, or 0=no timeout.
    If your clients don't say good-bye to the server, it will wait ptimo
    seconds waiting for any packet and then exit.

  After starting the server and automatically connecting to it, the master
  has to wait for the connects of all other players,
  calling vg_nw_waitforconnects().


RETURN VALUE
============
  If it succeeds, it returns 0.
  If an error occurs, it returns -1, giving out an error message to stderr.


SEE ALSO
========
  Index
  Understanding network
  vg_nw_setplayer()
  vg_nw_connect()
  vg_nw_waitforconnects()
  vg_nw_setvar()
  vg_nw_getvar()
  vg_nw_setcommon()
  vg_nw_getcommon()
  vg_nw_dumppacket()
  vg_nw_sendinit()
  vg_nw_recvinit()
  vg_nw_myplayer()
  vg_nw_maxplayer()
  vg_nw_virtualplayer()
  vg_nw_isalive()
  vg_nw_recvkeys()
  vg_nw_keypressed()
  vg_nw_mousepressed()
  vg_nw_mousex()
  vg_nw_mousey()
  vg_nw_senddata()
  vg_nw_sendcommon()
  vg_nw_setdead()
  vg_nw_dumpsprite()
  vg_nw_undumpsprite()
  vg_nw_close()