Пример #1
0
CAMLprim value iocp_ml_socket(value unit)
{
  CAMLparam1(unit);
  CAMLlocal1(res);
  res = win_alloc_socket(async_socket());
  CAMLreturn(res);
}
Пример #2
0
int async_net(const char* host, short port)
{
	int sockfd = async_socket();
	if (sockfd < 0)
	{
		return sockfd;
	}

	int ret = async_connect(sockfd, host, port);
	if (ret < 0)
	{
		close(sockfd);
		return ret;
	}
	return sockfd;
}