|
Open a socket and connect it to BrlAPI 's server
This function first loads an authentication key as specified in settings. It then creates a TCP socket and connects it to the specified machine, on the specified port. It writes the authentication key on the socket and waits for acknowledgement.
- Returns:
- the file descriptor, or -1 on error
- Note:
- The file descriptor is returned in case the client wants to communicate with the server without using libbrlapi functions. If it uses them however, it won't have to pass the file descriptor later, since the library keeps a copy of it. But that also means that brlapi_initializeConnection() may be called several times, but libbrlapi functions will always work with the last call's descriptor
- Example:
- Errors:
- BrlAPI might not be on this TCP port, the host name might not be resolvable, the authentication may fail,...
- Parameters:
-
| clientSettings | this gives the connection parameters, as described in brlapi_settings_t. If NULL , defaults values are used, so that it is generally a good idea to give NULL as default, and only fill a brlapi_settings_t structure when the user gave parameters to the program for instance; |
| usedSettings | if not NULL , parameters which were actually used are stored here, if the application ever needs them. |
- See also:
- brlapi_settings_t brlapi_loadAuthKey() brlapi_writePacket() brlapi_readPacketHeader() brlapi_readPacketContent() brlapi_readPacket()
|