Link to home
Start Free TrialLog in
Avatar of m00
m00

asked on

select(2)'ing a datagram socket

See title... it doesnt seem to work (linux 2.4.18)
Strace looks like:

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 8
setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(8, {sin_family=AF_INET, sin_port=htons(1029), sin_addr=inet_addr("0.0.0.0")}}, 16) = 0
fcntl64(8, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
select(9, [3 4 5 6 7 8], [], [], {1, 0}) = 1 (in [8], left {0, 220000})
getsockopt(8, SOL_IP, 0x50 /* IP_??? */, 0xbffff65c, 0xbffff648) = -1 ENOPROTOOPT (Protocol not available)
close(8)                                = 0
select(9, [3 4 5 6 7 8], [], [], {1, 0}) = -1 EBADF (Bad file descriptor)

My question is: Is this at all possible? If yes, how (what options)? If no, how should i do this considering i'm already select()'ing tcp ports (which works fine). Is there a generic way (for both stream and dgram) to do this?
Avatar of m00
m00

ASKER

Oops, its not the select() of course, the problem is getsockopt.. maybe somebody can give me a clue why
getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, sa, salen) wouldnt work there then.. :/
datagram socket have a destination surely?
ASKER CERTIFIED SOLUTION
Avatar of bryanh
bryanh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial