Skip to content

How to setup bidirectional communication with worker thread? #1512

Discussion options

You must be logged in to vote

We can't use a generic file descriptor, and rely on the sockepair syscall because it wont't work everywhere.
The API should be functional on all platforms that support BSD sockets, not only on unix-like OSs.
For example, on windows there is no socketpair. Also, you can't select() on non-socket fd on windows.

What's the issue with an UDP socketpair? On a loopback connection, an in-order data IO is guaranteed.
Also, UDP provides a nice property : if you send a data structure, you'll receive it un-fragmented.
So far I don't see any disadvantages in a UDP socketpair.
There might be one though: if you send data larger than a kernel socket buffer size, it might be dropped, I am not sure what se…

Replies: 6 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sebhub
Comment options

Comment options

You must be logged in to vote
1 reply
@sebhub
Comment options

Comment options

You must be logged in to vote
1 reply
@sebhub
Comment options

Comment options

You must be logged in to vote
1 reply
@sebhub
Comment options

Comment options

You must be logged in to vote
5 replies
@sebhub
Comment options

@cpq
Comment options

@sebhub
Comment options

@cpq
Comment options

@sebhub
Comment options

Answer selected by scaprile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants