package SPVM::Socket {
  
  our $AF_UNIX : ro int;
  our $AF_INET : ro int;
  our $AF_INET6 : ro int;

  our $SOCK_STREAM : ro int;
  
  has handle : int;
  
  BEGIN {
    init_native_constants();
  }
  
  native sub init_native_constants : void();
  
  native sub new : SPVM::Socket ($host : string, $port : int);
  native sub write : int ($self : self, $buffer : byte[], $legnth : int);
  native sub read : int ($self : self, $buffer : byte[]);
  
  native sub DESTROY : void ($self : self);
}
