/* * connects to server listening at host:port. conn is filled in with * relevant information, and is used in subsequent player function * calls * * Returns: * 0 if everything is OK (connection opened) * -1 if something went wrong (connection NOT opened) */ int player_connect(player_connection_t* conn, const char* host, int port);
Note that the connection will be blocking. A simple example:
... player_connection_t conn; /* Connect to Player server */ if(player_connect(&conn, "localhost", PLAYER_PORTNUM)) exit(1); ...