|
|
Synopsis Environment
Description Diagnostics
Globals Notes
See also Examples |
Synopsis |
#include "ucm.h" int
UcmOpen(sock);
T_SOCKET sock; |
Environment |
Unix, Win32
|
Description |
UcmOpen establishes an UCM server
side communication for the socket sock, that has been received by the
UcmServer(U) program or as
a function argument
from the UcmServer callback function DoService.
If the generic UCM server process UcmServer(U)
is used, the socket number is available as the first (and only) command line
argument and
should be converted to a T_SOCKET type through atoi(3). This BSD stream type
socket is a prerequisite for the use of all of the UCM library
functions. Before
terminating a process that has successfully called this function, UcmClose
and UcmTerm should be called to properly
release the socket. UcmOpen will fail if one or more of the following is
true:
| UE_NOTINIT |
The UCM software has not been initialize (see UcmInit) |
| UE_NOMEM |
The new socket could not be entered into the internal database, due to low
memory. |
| UE_ULMREG |
The product UCM is not registered in the license database. Enter
your activation key in the ulm(I) utility. |
| UE_ULMEXP |
The UCM license has expired. This error may occur in demo versions
only. |
| UE_ULMBUSY |
Too many users. The UCM license does not allow additional users at
this time. Please consult Unitec for details on how to increase your license. |
To provide error feedback to the client user, UcmOpen sends a message through socket
on all of the above license error conditions. Feedback messages all use the reserved message ID
_ucm_:
| Error |
Message ID |
Message |
Description |
| UE_ULMPROD |
_ucm_ |
E1 |
UCM not registered |
| UE_ULMEXP |
_ucm_ |
E2 |
License expired |
| UE_ULMBUSY |
_ucm_ |
E3 |
Too many users |
| UE_ULMVERSION |
_ucm_ |
E4 |
Version conflict |
The VB utility UcmInfo(U), which has been registered as auto start
program in the
UCM registry section by the Windows setup program, is the default sink for
these messages and will inform the user about the error in a message box. This utility is
available in VB source and may be modified (i.e. translated to the local
language) by the
software integrator. As an alternative, you may place an Ucm.ocx on your client
applications main form, set the InputID(P) property to
_ucm_ and leave the Servic(P)
property unset. This will prevent an automatic start of UcmInfo(U) and enables the
application to take appropriate actions by itself. For configuration
details, please
consult Chapter 10, Configuration and UcmConf(U).
|
Diagnostics |
Upon successful completion UcmOpen returns
UCM_SUCCESS. Otherwise, UCM_ERROR is returned and ucmErrno is set to indicate the
error.
|
Globals |
char *ucmProgName; /* reference */
|
Notes |
UcmOpen sets the linger options of socket to:
l_onoff = TRUE;
l_linger = 30;
For a detailed description of these options see setsockopt(2), so_linger. If your application needs different
settings, these should be made after the call to UcmOpen.
The global pointer char *ucmProgName, which is defined in ucm.h and
allocated in libucm.a, may optionally be set to the program name of the calling
task. This string will be used to identify possible messages on stderr. If ucmProgName
is not set, the default string UCM Library will be used. |
See also |
UcmClose, UcmServer,
UcmServer(U), UcmTerm
|
Examples |
#include
"ucm.h"
main(argc, argv)int argc;
char *argv[];
{
T_SOCKET sock; /*
socket from argv[1] */
ucmProgName = argv[0]; /* for UCM error msgs */
sock = atoi(argv[1]);
UcmInit();
if (UcmOpen(sock))
Error("UcmOpen failed, error=%d",
ucmErrno);
UcmSendf(sock, "MsgId", "Hello world");
UcmClose(sock);
UcmTerm();
return 0;
/*
terminate program */
} |
|
|
|