Advertisement

UDP and select

Started by August 03, 2002 10:06 AM
3 comments, last by LordKaT 22 years, 6 months ago
Hi folks, As you may have already guessed from the topic, Im a bit confused as to how to go about using select() with UDP. Im reading Beej''s tutorial right now, unfortunatly select() in a stream based enviornment doesnt seem to translate well to a datagram environment (to me anyway), could somone possibly guide me in the right direction? (I love lurking for months on end and then suddenly asking a question ) --LordKaT
LordKaT - what exactly seems to be the problem? select works just fine with udp sockets - in fact it''s easier with them -because you don''t call accept or connect on udp sockets, the error handling is more straightforward.

Advertisement
Err heh,

Nevermind I just woke up when I wrote that,

Actually, Ive figured out what it is Im supposed to do, but perhaps you could tell me what the "exceptfds" does?

--LordKaT
exceptfds - well, I''m not totally sure.

I know it does this -

1. it checks for the presence of out-of-band data available for reading. When do you get out-of-band data? Not sure - I know you can use the out-of-band ''channel'' deliberately. Also, when you have two udp sockets sending to each other on the same machine (maybe on the same domain) and one closes, you''ll get out-of-band data on the other one.

2. When you do a non-blocking connect call (with tcp sockets), and it fails, then the error is reported in exceptfds, and you use getsockopt with SO_ERROR to get the actual error. But with udp sockets, you don''t call ''connect'' anyway...

good luck
AFAIK the exceptfds is of no use to datagram sockets because OOB data and the connect thing are both related to streams and not datagrams.

This topic is closed to new replies.

Advertisement