Results 1 to 6 of 6

Thread: Client/Server Error: BadIDChoice

  1. #1
    Join Date
    Oct 2007
    Location
    Caracas - Venezuela
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Client/Server Error: BadIDChoice

    Hi!!!

    I have a problem with my client/server application (C, C++ and Qt). When I compile it, this is the error:

    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x36001fe
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x36001ff
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600200
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600201
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600202
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600203
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600204
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600205
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600206
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600207
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600208
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600209
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x360020a
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x360020b
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600212
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600214
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600215
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600216
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600217
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600218
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600219
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x360021a
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x360021b
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x360021c
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x360021d
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x360021e
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x360021f
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600220
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600221
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600224
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600225
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600226
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600227
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600228
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600229
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x360022a
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x360022b
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x360022c
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x360022e
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x360022f
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600230
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600231
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600232
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600233
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600235
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600236
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Extension: 153 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x3600237
    Xlib: unexpected async reply (sequence 0x266b)!
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 1 (X_CreateWindow)
    Resource id: 0x3600222
    Xlib: sequence lost (0x116ea > 0x16ea) in reply type 0x0!
    X Error: BadImplementation (server does not implement operation) 17
    Major opcode: 20 (X_GetProperty)
    Resource id: 0x0
    X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
    Major opcode: 53 (X_CreatePixmap)
    Resource id: 0x3600238


    This is the code that generates the error:

    Qt Code:
    1. //principal.cpp
    2. #include client.h
    3. ...
    4. ...
    5. void principal:: startProcess(){
    6. int pid= fork();
    7.  
    8.  
    9. if (pid<0){
    10. printf("fork fail");
    11. exit(1);
    12. }
    13.  
    14. if(pid==0){ // Child
    15. int portConnect;
    16. char name[32];
    17. int portWait = 30000;
    18.  
    19. waitForChat(portWait, name, &portConnect); //When waitForChat finish, means that other client request for Chat, so the application must show the new window chat.
    20. windowChat = new Chat;
    21. windowChat -> show();
    22. }
    23. }
    24.  
    25. //client.c
    26. ...
    27. ...
    28. void waitForChat(int PtWait,char *c, int *PtConnect){
    29.  
    30. int skt;
    31. int bnd;
    32. int lsn;
    33.  
    34. int client;
    35. struct sockaddr_in dirclient;
    36. struct sockaddr_in dirserv;
    37. char buffer[1024];
    38.  
    39.  
    40.  
    41. if ((skt = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
    42. perror("Clientv:waitForchat: socket");
    43. exit(1);
    44. }
    45.  
    46. dirserv.sin_family = AF_INET;
    47. dirserv.sin_port =htons(PtWait);
    48. dirserv.sin_addr.s_addr =INADDR_ANY;
    49.  
    50.  
    51. if ((bnd= bind(skt, (struct sockaddr *)&dirserv, sizeof(dirserv) )) < 0) {
    52. perror("Clientv:waitForchat:: bind");
    53. exit(1);
    54. }
    55.  
    56.  
    57. if ( (lsn=listen(skt, 100)) < 0) {
    58. perror("Clientv:waitForchat:: listen");
    59. exit(1);
    60. }
    61.  
    62. if ((client = accept(skt,NULL,0)) < 0){
    63. perror("Clientv:waitForchat: accept");
    64. exit(1);
    65. }
    66.  
    67.  
    68.  
    69. if (recv(client,buffer,1024,0) < 0){
    70. perror("Clientv:waitForchat: recv");
    71. exit(1);
    72.  
    73. }
    74.  
    75. sscanf(buffer,"%d %s",PtConnect,c);
    76.  
    77.  
    78. close(client);
    79.  
    80. }
    To copy to clipboard, switch view to plain text mode 
    What's the meaning of Error: BadIDChoice .....???
    How can I fix it???

    Thanks!!!
    Last edited by wysota; 27th November 2007 at 01:48. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Client/Server Error: BadIDChoice

    Where is Qt in that? All I see is C code wrapped into a class. It shouldn't cause any pixmap errors. The problem has to be elsewhere.

  3. #3
    Join Date
    Oct 2007
    Location
    Caracas - Venezuela
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Client/Server Error: BadIDChoice

    Most Qt code is in the rest of the file....but I don't have any problems with the rest, I have problems when I want to show a new window on startProcess():

    Qt Code:
    1. waitForChat(portWait, name, &portConnect); //When waitForChat finish,
    2. // means that other client request for Chat,
    3. // so the application must show the new window chat.
    4. windowChat = new Chat;
    5. windowChat -> show();
    To copy to clipboard, switch view to plain text mode 

    If I commented out this part of the code, the compile error doesn't occur, but I need show a new window...so...
    Last edited by wysota; 27th November 2007 at 03:11. Reason: Changed [qtclass] to [code]

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Client/Server Error: BadIDChoice

    First, these are not compile errors - they are X server runtime warnings that come from incorrect manipulation of X server resources (like widgets).

    The problems you experience are caused by the other part of the code even if they are revealed only when you use the code you posted. My very very long shot is that you try to manipulate widgets from within a worker thread, but without seeing the code, I can't say more.

    BTW. Using fork() in Qt apps is not a very good idea - it's probably what causes you problems.

  5. #5
    Join Date
    Oct 2007
    Location
    Caracas - Venezuela
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Client/Server Error: BadIDChoice

    First, Thanks for try to help me ....well, the rest of the code are 8 files (chat.h, chat.cpp, principal.h, principal.cpp, window.h, window.cpp, client.h, client.c) that is the reason for I doesn't post it!...Do I post it?? I think is too much for check!!

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Client/Server Error: BadIDChoice

    No, get rid of those fork() calls. Why do you want to start a separate process for each connection? And why don't you just use Qt networking capabilities instead of using the blocking low-level BSD socket interface? Currently you are doing everything wrong here

Similar Threads

  1. Client/Server doesn't work
    By mattia in forum Newbie
    Replies: 2
    Last Post: 1st November 2007, 13:31
  2. Dual TCP/IP Client/Server
    By jimroos in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2007, 21:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.