aboutsummaryrefslogtreecommitdiffstats
path: root/apps/client.c
blob: 54f4c337ba57e9183cb653837d6e11e13c8843a7 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * client.c:
 *
 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
 * All rights reserved.
 *
 */

static char rcsid[] = "$Id$";

/*
 * $Log$
 * Revision 1.2  2008/02/14 00:57:58  james
 * *** empty log message ***
 *
 * Revision 1.1  2008/02/13 18:05:06  james
 * *** empty log message ***
 *
 */

#include <sympathy.h>
#include "client.h"

static void client_msg(s)
{
          printf ("%p [%d] %s\n", s->msg, s->msg->hdr.size , s->msg->debug.msg );



}
void
client (void)
{
  Socket *s;
  fd_set rfds, wfds;

  s = socket_connect ("socket");


  if (!s)
    {
      printf ("no socket");
      return;
    }

  for (;;)
    {
      struct timeval tv = { 0, 100000 };


      FD_ZERO (&rfds);
      FD_ZERO (&wfds);

      socket_pre_select (s, &rfds, &wfds);

      select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);

      socket_post_select (s, &rfds, &wfds);

      while (s->msg)
        {
	  client_msg(s);
          socket_consume_msg (s);
        }
    }

}