[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Single UDP sockets : duplex capable?
From:       Yar Tikhiy <yar () comp ! chem ! msu ! su>
Date:       2006-11-29 5:41:30
Message-ID: 20061129054130.GH96853 () comp ! chem ! msu ! su
[Download RAW message or body]

On Tue, Nov 28, 2006 at 04:24:08PM -0500, Devon H. O'Dell wrote:
> 2006/11/28, Garrett Cooper <youshi10@u.washington.edu>:
> >Hello,
> >
> >    Just wondering, abstractly..
> 
> Both sides can read from and write to the socket file descriptor.
> You'll need to develop a protocol to determine when either given side
> is expecting to receive or to send data (if both sides sit around in
> read(2), you're not going to get much done) :)

... and if you want asynchronous conversation, i.e., data coming
anytime, consider using non-blocking sockets with select(2), poll(2),
or kqueue(2).  The particular choice depends upon the requirements
on the portability and performance of the application.  If you
target at as much systems as possible, using a ready-made wrapper
library such as libevent can be an option.

> > -------------------------
> >| A -[socket (UDP)]-> B |
> > -------------------------
> >
> >    A creates a UDP socket (call it 's1') to talk to B.
> >
> >    Can B use the same socket ('s2') to talk to A using read(2) or
> >recv(2), or does A have to accept(2) traffic from B using a different
> >socket?
> >
> >    The programming language I'm using is C (not C++).

-- 
Yar
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic