[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-bugs
Subject:    Re: Why can't I send a cmsg a second time.
From:       Philip Guenther <pguenther () proofpoint ! com>
Date:       2017-01-23 21:43:33
Message-ID: alpine.BSO.2.20.1701240735540.48536 () corwin ! local
[Download RAW message or body]

On Mon, 23 Jan 2017, Luke Small wrote:
> I'm trying to make a server that takes incoming requests and sends the 
> file descriptor to one of multiple awaiting forked processes that works 
> on them. I've simplified the procedure in server_sample.c , where it 
> just sends them to one receiver. Is there something not being 
> reinitialized after line 104 ?

The API is slightly quirky in order to associate control messages with the 
data they were sent with.  The practical result is that your recvmsg() 
calls must accept at least one byte of data (even if none is sent) to 
advance to the next message.

As a most reliable practice, include at least one byte of normal data in 
your messages when sending them and accept the data when receiving them.


Philip Guenther

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic