Advertisement
dram

Untitled

Apr 26th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. enum ST_ConStructID {
  2. STRUCT_INIT_NUM, // init character
  3. STRUCT_DATA_NUM, // actuall data
  4. };
  5. struct ST_ConInitChar {
  6. char * name;
  7. int hp_min;
  8. int hp_max;
  9. int mp_min;
  10. int mp_max;
  11. int yang;
  12. int charint;
  13. };
  14. //SEND
  15. int id=STRUCT_INIT_NUM;
  16. struct ST_ConInitChar a;
  17. a = { "NickName", python_func.py_getCurrentHp(), python_func.py_getMaxHp(), python_func.py_getMaxSp(), python_func.py_getMaxSp(), python_func.py_getMoney() };
  18. DWORD wpisano,wpisano2 = 0;
  19. wpisano = send(maindll_socket,(char *) &id, sizeof(id), 0);
  20. wpisano2 = send(maindll_socket, (char *)&a, sizeof(a), 0);
  21.  
  22. //recv
  23. unsigned __stdcall main_pipe_server(void* Args)
  24. {
  25. Sleep(500);
  26. LRESULT uiMessage;
  27. char wiadomosc[512];
  28. char tmpbuff[1024];
  29. int bytesRecv = SOCKET_ERROR;
  30. while (true){
  31. bytesRecv = recv(mainmenu::getInstance().dll_clients[0], wiadomosc, sizeof(wiadomosc), 0);
  32. if (bytesRecv > sizeof(int)){
  33. char * p = wiadomosc;
  34. int *pId = (int*)p;
  35. p += sizeof(*pId);
  36. if (*pId == STRUCT_INIT_NUM){
  37. ST_ConInitChar * a = (ST_ConInitChar *)p;
  38. if (sizeof(a) > 0 && strlen(wiadomosc) > 0){
  39. MessageBox(NULL, (LPCSTR)a->name, (LPCSTR) "DONE", NULL);
  40.  
  41. }
  42. }
  43. }
  44. Sleep(1000);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement