C(sockets): 'Invalid argument' error when using MSG_OOB
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
C(sockets): 'Invalid argument' error when using MSG_OOB
When I try to receive Out-of-band data by using the MSG_OOB flag in rcv(), I always get an error saying 'Invalid argument'.
The weird thing is that I can get the data through a rcv() using 0 as flags, which can't be right since the data was sent with send() using the MSG_OOB flag.
With protocols that support out-of-band data, the SO_OOBINLINE
option requests that out-of-band data be placed in the
normal data input queue as received; it will then be
accessible with recv or read calls without the MSG_OOB
flag. Some protocols always behave as if this option is
set.
So it's possible that on the receiving end SO_OOBINLINE is set, which means that even with send(..., MSG_OOB), the data will arrive in-band nonetheless. Maybe use an extra setsockopts() after calling socket(), just to be sure?
|->ok, thanks! Now what would be the option to use to negate this setting?
|
ok, forget about this, stupid questions 'man 2 setsockopt' told me:
... int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen);...
and Most socket-level options utilize an int parameter for optval. For setsockopt, the parameter should be non-zero to enable a boolean option, or zero if the option is to be disabled.
ok, I set the option SO_OOBINLINE to false, but it still come through otherwise. I am using TCP, TCP should support this shouldn't it? Ethereal marks them as urgent, so it really should work if everything is set right at the receiver side...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.