Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include<menuet/network.hpp>
  2.  
  3. UDP_Socket::UDP_Socket(__u32 local_port,__u32 remote_port,__u32 remote_ip,bool close_on_delete)
  4. {
  5.  this->p[0]=local_port;
  6.  this->p[1]=remote_port;
  7.  this->p[2]=remote_ip;
  8.  this->f=close_on_delete;
  9. }
  10.  
  11. UDP_Socket::~UDP_Socket()
  12. {
  13.  if(this->f) this->Close();
  14. }
  15.  
  16. int UDP_Socket::Open()
  17. {
  18.  return (sock=__menuet__open_UDP_socket(p[0],p[1],p[2]));
  19. }
  20.  
  21. int UDP_Socket::Close()
  22. {
  23.  return __menuet__close_UDP_socket(sock);
  24. }
  25.  
  26. int UDP_Socket::Read(__u8 * data)
  27. {
  28.  return __menuet__read_socket(sock,data);
  29. }
  30.  
  31. int UDP_Socket::Write(int count,void * data)
  32. {
  33.  return __menuet__write_UDP_socket(sock,count,data);
  34. }
  35.  
  36. int UDP_Socket::Poll()
  37. {
  38.  return __menuet__poll_socket(sock);
  39. }
  40.