Towards a BBS server

Created 2022-07-20

So, I've made myself a gopher, spartan and gemini server. What next? I know, a BBS server.

I figured that with a BBS I'd get more interactivity, assuming anyone logs onto it. It's amazing what people have been able to do with Amigas, C64s, and even the humble ZX Spectrum.

I'll be using a Raspberry Pi for my server. What with the price of electricity these days it's a good choice. I'll be sticking with FreeBSD. I'm new to FreeBSD, but I think it's a good system. I like to think of it as "Slackware done right". Sorry, Slackers.

I'm programming in C++20, which is hot off the press. C++20 has some nice threading stuff. jthreads seem pretty neat. I also like the lock_guard for mutexes. I'm fairly fresh to threading, and C++ makes it relatively painless. There are a few conveniences I'd like to see, but it's pretty good for now. I had played around a little with Zig and Golang. In restrospect I don't think they provide a convincing win. I'm leery of Rust, as from what I've been reading, the whole async thing seems a bit of a mess.

The real problem with C++ is that it seems dog-slow to compile on a Raspberry Pi, even a 3. Stroustrop seems to be gunning for a factor of 10 improvement (at least) for compilation time. That would be most welcome. The saving grace is that I can test on a fast machine and deploy on a Pi. So there's less waiting around.

My BBS is rather lacking in features. I have got a Wall working, so it will be fun to see if anyone writes on it. That, for me, is the appeal of writing a BBS: a sense of community. BBSs allow for a lot more interactivity. With Gemini et alit feels that you're casting your missives into the void.

My BBS is intended to work over telnet. SyncTerm seems a popular client, but I'm going to aim for something that everyone is sure to have.

Security is non-existent. There is a report of people trying to breach Gemini servers, and I don't know how to make my BBS server resistant to that kind of thing. BBS servers have persistent, so I imagine it is relatively straightforward to mount denial of service attacks. I'll need to put in place mechanisms to limit the number of connections. I should probably great a watchdog that will kick folks off if they spend too long on it. I'm going to need to restructure my code to do that. Doing all this in modern C++ is going to be a lot easier than C. I imagine that some of that original BBS software is pretty hairy.

Grappling with POSIX sockets hasn't exactly been smooth sailing. There were noises made about C++ incorporating a network library. Probably best not to hold my breath as there's so many details to consider. I hope we get something rather nicer than POSIX. I eventually managed to get connections to be non-blocking, only to discover that I couldn't correctly detect if data was unavailable. Presumably the answer is out there somewhere. I decided to revert the sockets to blocking. This should be fine in most cases, but isn't going to work where you want to synchronously send and receive data. I'm thinking that I might be able to put the reciving end in a separate thread, but I'm not sure if that will work.

Anyway, just my ramblings on the matter. Take care.