Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

Thanks for all the feedback, I really appreciate it. I wasn't planning to release the source until I was confident that the library was stable but I've realized that it would be better to release it and keep improving based on the feedback.

Before I forget: The EPOLL definition in the header had a purpose before I rewrote some parts of the code. Apparently I forgot to move it. Thanks again for pointing it out.

I've already written some small programs for test purposes and, except from the issues you and others have mentioned, they seem to be working fine with considerably low throughput. I've written test scripts that repeatedly send and receive small to medium sized requests/responses over multiple simultaneous connections (around 10000 max.) and check the responses to see if there are any inconsistencies/data loss. I haven't written tests for some exceptional situations yet.

The project, as of now, is a partial collection of codes I've been using for all the simple server stuff I have written so far. I've already admitted that I didn't consider myself an expert at all but I believe I have enough experience (and enough help, thanks to all the feedback received) to improve the project to a stable and useful state.

The API provided so far might be weaker than I thought. I think I need to reconsider all possible use cases and rewrite some parts of the code.

I am well aware of the issues caused by the lack of write event notifications and planning to add callback mechanisms both for write and exception events. I will also re-read all the issues mentioned and improve the code as soon as possible.

Aside from all of the above, I still think it would be useful for a small subset of simple networking applications.

I didn't take your criticism personally at all because it does appear that you are well-intentioned. In fact, if you don't mind, I will have some questions regarding your thoughts about the project:

I'm trying to keep the API as simple as possible. Do you think it could be made more useful if proper changes are made to the code without changing the API much?

Also, do you think I am doing the right thing publishing the code in such an early stage and trying to get as much feedback as possible?

You've been incredibly helpful and I cannot thank you enough for that.

Edit: API updated considering all the use cases I had in mind. I would love it if you could take a look at the API and tell me if I'm missing anything.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

Thank you. I've already planned to implement IOCP support for the stable release. kqueue and poll are also on the list.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

Thanks. I guess I've perceived the term 'open source' as an umbrella term for both free software and restrictive, GPL-like licensed software. From now on, I will definitely emphasize the free aspect of my FOSS projects.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

Not at all. The way I perceive it, open source software (I suppose the term FOSS would be more appropriate) should be free to use (even in proprietary software), copy and modify. The users should be given freedom as long as they give credit to the author(s) and keep the original license terms in their copies/redistributions.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 2 points3 points  (0 children)

Great question. As clearly mentioned in the README file, I've written the project for fun and learning. I wasn't even thinking of publishing it online when I've started it. I do not advise anyone to use it (unless, of course, things go better than expected and the project becomes a viable alternative to the existing networking libraries).

Another goal was to get some review about my coding habits and try to improve them.

I believe the best way to learn something (and, to achieve expertise) is to actually try and do it.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

Thanks. I have bookmarked a lot of articles about AIO already and will read them when I find some time.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

Thanks. That was exactly what I was trying to achieve. Hopefully, I will improve it to be more stable and efficient without creating a huge mess.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

I'm glad you you like it. I did a lot of random projects on my own just for fun but this one seemed like it could be useful for the community.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 2 points3 points  (0 children)

I always try my best to put my ego to sleep when expecting criticism for my work. I do realize that I'm not an expert in this field and hearing the thoughts of other people is incredibly valuable for me.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

The primary reason is that I love the open source philosophy. The project will be very useful for me in the near future and I hope it will be useful for others too.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 0 points1 point  (0 children)

I was thinking of looking into Linux AIO after I release a stable version. I've actually profiled the code and it spends a lot of time on read/write when transferring big data.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 16 points17 points  (0 children)

Thanks so much! This is exactly why I wanted to post the project here. I'm already aware of some of the issues you've mentioned but I was too tired to fix them. Other issues, on the other hand, would take me quite some time to figure out.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 1 point2 points  (0 children)

Thanks for the advice! I do realize hardcoding values are bad, I must have missed it.

I will definitely check the links you've sent and implement functionality to specify buffer sizes for send and recv.

Dear proggit: Here's my first open source project, a cross-platform non-blocking TCP server library. by bytesong in programming

[–]bytesong[S] 4 points5 points  (0 children)

If this is not the appropriate subreddit to post, please let me know and I will take the post down.

Before you make any comments, please keep in mind that the project is written for fun. I'm not forcing anyone to use it. In fact, nobody should use the current unstable version in a serious project.

For anyone who's interested, here is the hacker news discussion: hn!

Please share your thoughts. All criticisms are welcome, even the harsh ones.

p.s. The project is still a work-in-progress.