From: Ben Greear <greearb@candelatech.com>
To: linux-net <linux-net@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Does select (for write) work on PACKET_SOCKETs ?
Date: Tue, 26 Jun 2001 15:00:58 -0700 [thread overview]
Message-ID: <3B39061A.4CFE75E8@candelatech.com> (raw)
It does not seem to work for me like I want it to. Basically,
it seems that it always takes the entire timeout (50-80 ms in my
case), but at least the socket descriptor is SET when select returns. I want
it to return as soon as the socket is writable, which at low (56kbps)
speed on a 100bt NIC should be immediate, or certainly less than 50ms.
I'm using kernel 2.4.6-pre3 with RH 7.1.
Here is a snippet of code that does the socket creation (I am binding in this case.):
int createPacketSocket(const char* dev_name, int ether_type, int dev_idx, int should_bind) {
LF_TRC_IN;
VLOG << "dev_name -:" << dev_name << ":- dev_idx: " << dev_idx
<< " type (decimal): " << ether_type << endl;
int s = socket(PF_PACKET, SOCK_RAW, htons(ether_type));
int r; //retval
if (s < 0) {
cerr << "ERROR: socket: " << strerror(errno) << endl;
VLOG << "ERROR: socket: " << strerror(errno) << endl;
return s;
}
if (should_bind) {
struct sockaddr_ll myaddr;
memset(&myaddr, '\0', sizeof(myaddr));
myaddr.sll_family = AF_PACKET;
myaddr.sll_protocol = htons(ether_type);
myaddr.sll_ifindex = dev_idx;
//strcpy(myaddr.sa_data, dev_name);
r = bind(s, (struct sockaddr*)(&myaddr), sizeof(myaddr));
if (r < 0) {
cerr << "ERROR: bind: " << strerror(errno) << endl;
VLOG << "ERROR: bind: " << strerror(errno) << endl;
return r;
}
}
nonblock(s);
return s;
}
Any ideas?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com> <Ben_Greear@excite.com>
President of Candela Technologies Inc http://www.candelatech.com
ScryMUD: http://scry.wanfear.com http://scry.wanfear.com/~greear
reply other threads:[~2001-06-26 22:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3B39061A.4CFE75E8@candelatech.com \
--to=greearb@candelatech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox