Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Migrating from ev_http: How to get the socket for evhtp_accept_socket()? #155

Open
RokerHRO opened this issue May 13, 2020 · 1 comment
Open

Comments

@RokerHRO
Copy link

RokerHRO commented May 13, 2020

I'm porting my program from ev_http to libevhtp.

So I'm calling evhtp_accept_socket() but this function wants a evutil_socket_t. Where do I get this from? In ev_http the "bind_socket" function returns a socket that I can put into accept_socket.

Unfortunately the examples are lacking any documentation, also the evhtp.h has fancy Doxygen comments, but without enough information in it (e.g. is 0 or -1 the error return value? What does the "backlog" parameter mean? etc.), so I don't see where the socket is bound (and to which address and port?), where the accept is done and how etc.

It would be nice if the examples would contain more comments and Doxygen comments in evhtp.h are filled and not only dummies.

Even better when there would exist a migration guideline document, I think I am not the first person who wants to migrate from ev_http to libevhtp.

@RokerHRO
Copy link
Author

Okay, it seems that evhtp_bind_socket() does a lot more than just binding the socket. It also does the "listen()" and "accept()" of the classic BSD socket API. Am I right? It should be documented more clearly so people that are familiar with the classic BSD socket API are not confused about the magic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant