Subversion Repositories Projects

Rev

Rev 130 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 130 Rev 483
Line 50... Line 50...
50
  free( ii );
50
  free( ii );
51
  close( sock );
51
  close( sock );
52
  return 1;
52
  return 1;
53
}
53
}
Line 54... Line 54...
54
 
54
 
55
struct timeval timeout;
55
//struct timeval timeout;
56
fd_set readfds, writefds;
56
fd_set readfds, writefds;
57
int s;
57
int s;
58
struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
58
struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
59
char buf[1024] = { 0 };
59
char buf[1024] = { 0 };
Line 104... Line 104...
104
{
104
{
Line 105... Line 105...
105
 
105
 
106
  // try to accept connection if none yet
106
  // try to accept connection if none yet
107
  if (!bt_host_connected)
107
  if (!bt_host_connected)
108
  {
108
  {
109
    timeout.tv_sec = 0;
109
    //    timeout.tv_sec = 0;
110
    timeout.tv_usec = 100;
110
    // timeout.tv_usec = 100;
111
    FD_ZERO(&readfds);
111
    FD_ZERO(&readfds);
112
    FD_ZERO(&writefds);
112
    FD_ZERO(&writefds);
113
    FD_SET(s, &readfds);
113
    FD_SET(s, &readfds);
Line 114... Line 114...
114
    maxfd = s;
114
    maxfd = s;
115
   
115
   
-
 
116
    printf("waiting for connection\n");
116
    printf("waiting for connection\n");
117
    //    status = select(maxfd + 1, &readfds, &writefds, 0, &timeout);
117
    status = select(maxfd + 1, &readfds, &writefds, 0, &timeout);
118
    status = select(maxfd + 1, &readfds, &writefds, 0,& (struct timeval) { 0, 100 });
118
    if( status > 0 && FD_ISSET( s, &readfds ) ) {
119
    if( status > 0 && FD_ISSET( s, &readfds ) ) {
119
      // incoming connection
120
      // incoming connection
120
      client = accept( s, (struct sockaddr*)&rem_addr, &opt );
121
      client = accept( s, (struct sockaddr*)&rem_addr, &opt );
Line 143... Line 144...
143
      printf("reading from bt_host");
144
      printf("reading from bt_host");
144
      char in_char='#';
145
      char in_char='#';
145
      int count=0;
146
      int count=0;
146
      int r=0;
147
      int r=0;
Line 147... Line 148...
147
 
148
 
148
      timeout.tv_sec = 0;
149
      //      timeout.tv_sec = 0;
149
      timeout.tv_usec = 100;
150
      //timeout.tv_usec = 100;
150
      FD_ZERO(&readfds);
151
      FD_ZERO(&readfds);
151
      FD_ZERO(&writefds);
152
      FD_ZERO(&writefds);
152
      FD_SET(client, &readfds);
153
      FD_SET(client, &readfds);
Line 153... Line 154...
153
      maxfd = client;
154
      maxfd = client;
154
     
155
     
155
      printf("waiting for connection\n");
156
      printf("waiting for connection\n");
156
      status = select(maxfd + 1, &readfds, 0, 0, &timeout);
157
      //status = select(maxfd + 1, &readfds, 0, 0, &timeout);
157
      if( status >0 )
158
      if( status >0 )
158
        {
159
        {
159
          send(mk_fd,"\r",1,0);
160
          send(mk_fd,"\r",1,0);