Version française
Home     About     Download     Resources     Contact us    
Browse thread
UDP client
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alexsandro Soares <a_s_soares@y...>
Subject: UDP client
Hi all,

  I'm working in an UDP client, but I can't figure out how to get the same behaviour, in OCaml, such as the C code below:

-----------------------------------------------------------------------------------------------

  sigset_t sigmask;

  sigemptyset(&sigmask);
  sigaddset(&sigmask, SIGIO);      
  sigprocmask(SIG_BLOCK, &sigmask, NULL);
  
  /*
   *  Open UDP socket.
   */
  if( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0){
    return sock ;      /* Can't open socket. */
  }
  
  if (fcntl(sockfd, F_SETOWN, getpid()) == -1) return sock;

  val = fcntl(sockfd, F_GETFL, 0) ;

  val |= O_NONBLOCK ;
  val |= FASYNC;
  fcntl(sockfd, F_SETFL, val) ;

------------------------------------------------------------------------------------

Could anyone help me?

Thanks,

Alex




__________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/