summaryrefslogtreecommitdiff
path: root/support/dktools/dk4socka05.ctr
blob: 5a15106e36d36acf7b9a30511d47a9b93b04b3a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%%	options

copyright owner	=	Dirk Krause
copyright year	=	2015-xxxx
license		=	bsd



%%	module


#include "dk4app.h"
#include "dk4socka.h"



int
dk4socket_listen_app(
  dk4_socket_t	 sock,
  int		 bl,
  dk4_app_t	*app
)
{
  dk4_er_t	 er;
  int		 back = DK4_SOCKET_RESULT_FAILED;
  dk4error_init(&er);
  back = dk4socket_listen(sock, bl, &er);
  if (DK4_SOCKET_RESULT_SUCCESS != back) {
    dk4socket_log_simple_1(app, DK4_LL_ERROR, 5, &er);
  }
  return back;
}



dk4_socket_t
dk4socket_accept_app(
  dk4_socket_t		 sock,
  struct sockaddr	*pAddr,
  size_t		*pSzAddr,
  dk4_app_t		*app
)
{
  dk4_er_t		 er;
  dk4_socket_t		 back = INVALID_SOCKET;
  dk4error_init(&er);
  back = dk4socket_accept(sock, pAddr, pSzAddr, &er);
  if (INVALID_SOCKET == back) {
    dk4socket_log_simple_1(app, DK4_LL_ERROR, 6, &er);
  }
  return back;
}