Subversion Repositories Kolibri OS

Rev

Rev 3439 | Blame | Last modification | View Log | Download | RSS feed

  1. #define SOCKET_PASSIVE 0
  2. #define SOCKET_ACTIVE  1
  3. inline fastcall dword OpenSocket( ECX, EDX, ESI, EDI)
  4. {
  5.         $mov eax,53
  6.         $mov ebx,5
  7.         $int 0x40
  8. }
  9.  
  10. inline fastcall dword CloseSocket( ECX )
  11. {
  12.         $mov eax, 53
  13.         $mov ebx, 8
  14.         $int 0x40
  15. }
  16.  
  17. inline fastcall int StatusSocket( ECX)
  18. {
  19.         $mov eax,53
  20.         $mov ebx,6
  21.         $int 0x40
  22. }
  23.  
  24. inline fastcall dword ReadSocket( ECX)
  25. {
  26.         $mov eax,53
  27.         $mov ebx,3
  28.         $int 0x40
  29.         return BL;
  30. }
  31.  
  32. inline fastcall dword ReadNetworkData( ECX, EDX, ESI)
  33. {
  34.         $mov eax, 53
  35.         $mov ebx, 11
  36.         $int 0x40
  37. }
  38.  
  39. inline fastcall dword PollSocket( ECX)
  40. {
  41.         $mov eax,53
  42.         $mov ebx,2
  43.         $int 0x40
  44. }
  45.  
  46.  
  47. inline fastcall dword WriteSocket( ECX, EDX, ESI)
  48. {
  49.         $mov eax,53
  50.         $mov ebx,7
  51.         $int 0x40
  52. }
  53.  
  54. inline fastcall int IsPortFree( ECX)
  55. {
  56.         $mov eax,53
  57.         $mov ebx,9
  58.         $int 0x40
  59. }
  60.  
  61. unsigned int GetFreePort(int port_i)
  62. {
  63.         for (; port_i<65535; port_i++;)
  64.                 if (IsPortFree(port_i)==1) return port_i;
  65.         return 0;
  66. }
  67.