+ #if USE_TCP
+ {
+ tRequestAuthHdr auth;
+ auth.pid = giSyscall_ClientID;
+ auth.key = 0;
+ SendData(&auth, sizeof(auth));
+ int len = ReadData(&auth, sizeof(auth), 5);
+ if( len == 0 ) {
+ fprintf(stderr, "Timeout waiting for auth response\n");
+ exit(-1);
+ }
+ giSyscall_ClientID = auth.pid;
+ }
+ #else
+ // Ask server for a client ID
+ if( !giSyscall_ClientID )
+ {
+ tRequestHeader req;
+ int len;
+ req.ClientID = 0;
+ req.CallID = 0;
+ req.NParams = 0;
+
+ SendData(&req, sizeof(req));
+
+ len = ReadData(&req, sizeof(req), 5);
+ if( len == 0 ) {
+ fprintf(stderr, "Unable to connect to server (localhost:%i)\n", SERVER_PORT);
+ exit(-1);
+ }
+
+ giSyscall_ClientID = req.ClientID;
+ }
+ #endif
+