Solved

select(2)'ing a datagram socket

Posted on 2002-07-26
2
617 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:m00
2 Comments
 

Author Comment

by:m00
ID: 7180905
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?
0
 
LVL 5

Accepted Solution

by:
bryanh earned 300 total points
ID: 7181258
> datagram socket have a destination surely?

No, that's what it means to be a datagram socket.  You can send to anywhere at any time through it (or receive from anywhere at any time through it).
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question