[prog] [C] network programming

Shuying shuyingw at cse.unsw.EDU.AU
Mon Oct 14 09:49:48 EST 2002


Yes, but only if I'm using TCP or some connection-oriented protocol. UDP
and other connectionless protocols do not make use of listen() or
accept(). I can use connect() with recv() and send() , but there's not a
whole lot of difference from just using recvfrom()/sendto().

--Shuying


On Sun, 13 Oct 2002, Cliff Crawford wrote:
> It looks like you're missing calls to listen() and accept().  IIRC
> (been a while since I've played with sockets :), you should be doing
> something like the following:
>
> listen(sockfd, blah, blah);
> while(1) {
>         accept(sockfd, ...);
>         /* now you can call recv(), send(), etc. on the socket */
> }





More information about the Programming mailing list