1 /***********************************************************************/
5 /* Xavier Leroy and Pascal Cuoq, projet Cristal, INRIA Rocquencourt */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../../LICENSE. */
12 /***********************************************************************/
14 /* $Id: connect.c 7697 2006-10-18 08:26:54Z xleroy $ */
18 #include "unixsupport.h"
19 #include "socketaddr.h"
21 CAMLprim value unix_connect(socket, address)
22 value socket, address;
24 SOCKET s = Socket_val(socket);
25 union sock_addr_union addr;
26 socklen_param_type addr_len;
29 get_sockaddr(address, &addr, &addr_len);
30 enter_blocking_section();
31 if (connect(s, &addr.s_gen, addr_len) == -1)
32 err = WSAGetLastError();
33 leave_blocking_section();
36 uerror("connect", Nothing);