Re: Non-blocking Accept in C

From: Rodrigo Ormonde (ormonde@aker.com.br)
Date: Tue Jan 11 2000 - 07:30:55 EST


At 17:53 10/01/2000 -0600, Larry Griffin wrote:
>Resident Network Geniuses!
>
>I've changed how an data collection server of mine deals with a
>customers client. This change requires that I don't hang around after
>listen if there are no connection requests to accept. My networking
>books by Rago and Stevens hint at what I should do but as soon as they
>bring the subject up then talk about the client only. None of my test
>programs (server side) seem to know when there is a connection request
>pending.
>
>ie.
>
>bind or bind or bind
>select set non_blocking set non_blocking
>accept accept select
>return restore fcntl accept
> return restore fcntl
> return
>
>Can anyone show or point me to an example that works?

  The correct order is:

  socket()
  bind()
  listen()
  select()
  accept()

  You should call accept only if select() says that you can read from the
socket, which means that there is a pending connection.

  Regards,

--
Rodrigo de La Rocque Ormonde
e-mail: ormonde@aker.com.br
Aker Security Solutions - http://www.aker.com.br

- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.rutgers.edu



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:29 EST