Hi, maybe I am a bit late, however this is what I found.
// argv[1] contains your ip address
// personalize server configuration
UA_ServerConfig *config = UA_ServerConfig_new_minimal(4840, NULL); // set the port
// set hostname to ip address
UA_String name;
UA_String_init(&name);
name.length = strlen(argv[1]);
name.data = (UA_Byte *) argv[1];
UA_ServerConfig_set_customHostname(config, name);
// create server
UA_Server *server = UA_Server_new(config);
// some code to build your information model
// ...
// run server
UA_StatusCode retval = UA_Server_run(server, &running);
UA_ServerConfig_set_customHostname modifies the standard configuration using the IP contained in 'name', instead of 'localhost'. I found it looking at the source code so I don't know if it is the best solution, but it works (with uaexpert client I am able to connect to ocp.tcp://<my-ip>:4840/).
Hope this helps,
Matteo