Subversion Repositories Kolibri OS

Rev

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 int StatusSocket( ECX)
  11. {
  12.         $mov eax,53
  13.         $mov ebx,6
  14.         $int 0x40
  15. }
  16.  
  17. inline fastcall dword ReadSocket( ECX)
  18. {
  19.         $mov eax,53
  20.         $mov ebx,3
  21.         $int 0x40
  22.         return BL;
  23. }
  24.  
  25. inline fastcall dword PollSocket( ECX)
  26. {
  27.         $mov eax,53
  28.         $mov ebx,2
  29.         $int 0x40
  30. }
  31.  
  32.  
  33. inline fastcall dword WriteSocket( ECX, EDX, ESI)
  34. {
  35.         $mov eax,53
  36.         $mov ebx,7
  37.         $int 0x40
  38. }
  39.  
  40. inline fastcall int IsPortFree( ECX)
  41. {
  42.         $mov eax,53
  43.         $mov ebx,9
  44.         $int 0x40
  45. }
  46.  
  47. unsigned int GetFreePort(int port_i)
  48. {
  49.         for (; port_i<65535; port_i++;)
  50.                 if (IsPortFree(port_i)==1) return port_i;
  51.         return 0;
  52. }
  53.