[V4RB] Writing a simple server

jda jda at his.com
Tue Feb 11 10:09:11 CST 2003


>I've done something similar; although the backend here is not a
>Valentina DB but rather a pre-existing MS SQL-Server DB. (I _wish_ it
>was Valentina, though. :)
>
>The one thing I stummbled over was that I initially picked the standard
>HTTP port 80, and has lots of myterious crashes. After I added decent
>logging, I found out that the reason was a huge amount of attempted
>buffer overflow attacks from the outside. After I changed that port (and
>closed the port 80 on the firewall just for good measure), everything
>went fine.

That's great. Matt Neuberg's examples use port 2001 (he probably 
picked it because it was the year when he wrote it) but so far it 
works for me. Apparently in OS X the magic number is 1024 -- anything 
less can only be used by the root user.

>
>There are some reports of the RB4 socket failing when multiple
>connection requests arrive at the same time, and because of this I'm
>destroying and re-creating my socket every other hour, and so far it
>runs pretty flawless.

I think that the RB 5 SuperSocket class is going to handle this 
automatically -- another reason to wait for that to deploy.

>
>I think the decision if you want to use multithreading depends on how
>much work your application does between the retrieval from the database
>and the HTTP response. If that's not too much work, I'd rather go for a
>single-socket, single-threaded application. But it also depends on the
>type of client (a web browser? Or a client application?) and the number
>of clients/expected hits.

It can be a lot. But since this is intended for modest use (to serve 
Valentina dbs over the web to a presumably small number of people) I 
intend to stick with single-threaded for now.

>
>And don't forget to use proper Authentication. Especially if you're
>going to use port 80. :)

What is proper Authentication (and how do you do it)?

Oh, and BTW, is there a maximum number of characters you can send in 
a reply (like 32767)? That was a limit cor cgi's in OS 9, and I read 
somewhere that it was imposed by AppleEvents, not by HTTP.

Thanks for the info!

Jon


More information about the Valentina mailing list