flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > TCP/IP Web Server |
Author |
|
HyperVista 27 Sep 2006, 12:59
hi f14t (cool nick). I think Dex4U did one not too long ago. I don't have time this moment to look for it. but you can search for Dex4U posts and find it here on the board.
cheers! |
|||
27 Sep 2006, 12:59 |
|
vid 27 Sep 2006, 13:19
wouldn't you post your sources?
|
|||
27 Sep 2006, 13:19 |
|
arafel 27 Sep 2006, 13:34
f14t wrote:
Well, since web server's basic purpose is to handle and process numerous requests at the same time it would be wise to improve on the basic design first, so if you use simple threaded model it would wise switching to AIO. As for other, less important, features: some kind of modular interface like Apache's one (so for example webserver could work with ssl, perl interpreter, etc. ) is a big plus. |
|||
27 Sep 2006, 13:34 |
|
Dex4u 29 Sep 2006, 01:14
Yes HyperVista, is right i am making a web server for my OS Dex4u, fully tested and works fine, but need to add more drivers and function etc.
Taking abit of a break, working on porting Dex4u to ARM. Info here: http://jas2o.forthworks.com/dexforum/index.php?topic=114.0 http://jas2o.forthworks.com/dexforum/index.php?topic=117.0 http://board.flatassembler.net/topic.php?t=5650 |
|||
29 Sep 2006, 01:14 |
|
f0dder 29 Sep 2006, 06:43
f14t: look at /dev/epoll if you want to handle many clients.
|
|||
29 Sep 2006, 06:43 |
|
f14t 14 Oct 2006, 10:29
the guy who started it all
vid wrote: wouldn't you post your sources? no. because i cant. technically speaking, i browse the net in a cafe. and i write my programs at home on my no-feature and frills intel PC. apparentyl i don't have a cd-writer or a working floppy-drive to take my code from home to cafe. thanks every-body for replying. sorry for the curious ones, i really am unable to share my code. [/b] |
|||
14 Oct 2006, 10:29 |
|
gunblade 19 Oct 2006, 15:14
Well, i've coded one of these as well. Very simple, but small, and fast.
Be warned though, its very nasty code (I dont comment, and ive probably left out some really obvious possible optimizations (if you can see any which would make a big difference, would love to hear about them)). It uses linux syscalls and sends the files using the kernel call sendfile (187). It's multithreaded, and very fast, (Its what i usually use to transfer large files over the LAN, or to temporarily host files for people to download). And since it doesnt use any external library, has a very small memory footprint. Another warning: dont use it for real purposes . Not for my sake, but the httpd is _very_ unsecure, for example, if you run it, then use a browser to go to http://127.0.0.1//etc/passwd ... well.. you can guess what happens I do plan to fix this some time.. but got so much coursework to do for university, it's hard to find the time. Use the code as you wish though, and oh, the string converting functions at the bottom of the code aren't mine, i saw them on this forum (sorry, cant remember who coded them), and they were a lot better than the ones i made. And just before i give you the code, the usage for the httpd is either ./httpd, which runs the the server on port 80 using the current directory as the webroot, otherwise, ./httpd <portnumber> to run it on the port number you want (without the <>.. so: ./httpd 15023 for example). Edit: The code's been updated, and moved to 3 posts down. Last edited by gunblade on 05 Nov 2006, 03:56; edited 1 time in total |
|||
19 Oct 2006, 15:14 |
|
f14t 31 Oct 2006, 10:38
Thanks Gun Blade (Steel one or Iron one) !
I will try your code at home. |
|||
31 Oct 2006, 10:38 |
|
vid 31 Oct 2006, 10:47
gunblade: in fact, your code looks pretty straightforward and nice. it would be nice to add some comments and make example from it
|
|||
31 Oct 2006, 10:47 |
|
gunblade 05 Nov 2006, 04:06
Wow, its quite scary how many bugs i found in this code, yet somehow it managed to balance the bugs into a working program.
Anyway, I've commented and fixed up the code. Now the automatic redirection to index.html if you try to open a directory in your browser works fine. More description is in the code. This time round I'll upload the source as a file, seeing as it's now 517 lines long. Any other flaws/ideas/comments you have on the code, I'd be happy to hear about. I learned quite a lot from going over this code again, and fixing all those errors. I also stayed awake until 4am without noticing. If anyone feels like including this in any examples thread/package/page, or grabbing any of the code for their own things, feel free. It shows the basics of sockets, threads, and handling signals in linux.
|
|||||||||||
05 Nov 2006, 04:06 |
|
LocoDelAssembly 05 Nov 2006, 15:02
gunblade, why do you use sys_fork? There is no "CreateThread" syscall?
Maybe sys_clone can create a thread?(I'm not sure) [edit] I found this http://www.die.net/doc/linux/man/man2/clone.2.html [/edit] |
|||
05 Nov 2006, 15:02 |
|
gunblade 05 Nov 2006, 15:55
I indeed could use sys_clone, but is there a specific reason I'd want to use it? As far as i can tell, the main difference between clone and fork is that clone makes a copy of the stack (and even the data?), which is unnecessary in my code.
(Unless you've spotted a mistake that I haven't picked up, in which case please do tell ) Thanks, gunblade |
|||
05 Nov 2006, 15:55 |
|
LocoDelAssembly 05 Nov 2006, 16:17
fork create a completely new process which is a copy of its parent, but with clone (and the appropiate flags) creates a thread that shares the context with its parent so there is no memory copy. sys_clone is more similar to CreateThread of Windows (again, when you use the flags otherwise if you provide 0 its exactly the same that fork).
Here another link http://www.ibiblio.org/pub/Linux/docs/faqs/Threads-FAQ/html/ |
|||
05 Nov 2006, 16:17 |
|
gunblade 05 Nov 2006, 16:45
Aah, whoops, must've gotten those mixed up.
Well ill look into it, see if it's any faster with the cloning rather than the forking, because I deffinetly don't need a full copy of all the data, only certain variables. Thanks a lot |
|||
05 Nov 2006, 16:45 |
|
Madis731 08 Nov 2006, 13:11
Is there a fork/clone/thread comparison? What do they actually mean and which is better in which case.
|
|||
08 Nov 2006, 13:11 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.