here's the source for the web server that i just wrote... it works, but it's slow. just a little something to dissect for anyone wanting to code their own web server. it's rather modular allowing for changes and additions (such as virtual directories), so feel free to play around!

this isn't a serious project at all - i was testing out/learning to use winsock :) it's also quite small when assembled. basic config and messages are in the constants include file.
Posted on 2002-06-14 15:48:55 by jademtech
Jademtech, thanks for the source. The server runs with XP, but some points should be mentioned:

- the port of the server currently is 88 (should be 80)
- program will not load under Win9x ("wrong" align size). Should be relinked for that.
- for file transfer TransmitFile function is used. This possibly will not work for Win9x.

japheth
Posted on 2002-06-16 04:23:56 by japheth

Jademtech, thanks for the source. The server runs with XP, but some points should be mentioned:

- the port of the server currently is 88 (should be 80)
- program will not load under Win9x ("wrong" align size). Should be relinked for that.
- for file transfer TransmitFile function is used. This possibly will not work for Win9x.

1) i know :grin: it's just that i have my regular IIS server running on port 80 and i don't want to turn it off while i am testing stuff.

2) Really? i wouldn't know. never took up win32asm until i got WinNT.

3)

Windows NT/2000/XP: Included in Windows NT 3.51 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Mswsock.h.
Library: Use Mswsock.lib.

it should be fine, shouldn't it?

4) (i know, i made up #4) If you add ALIGN DWORDs here and there, you can increase performance by 40% or so (that's what i got, anyway) :grin: , at the expense of file size. If you are connecting to your own computer, running the task as a background process (i.e. low/very low priority) will greatly speed things up.
Posted on 2002-06-16 10:33:00 by jademtech
Jademtech,


3)

quote:
--------------------------------------------------------------------------------

Windows NT/2000/XP: Included in Windows NT 3.51 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Mswsock.h.
Library: Use Mswsock.lib.

--------------------------------------------------------------------------------


it should be fine, shouldn't it?




Yes, it should be fine, but if I use a disassembler for this export in MSWSOCK.DLL I get:



7B07746A 68 3D 27 00 00 push 0000273D
7B07746F E8 D7 05 00 00 call 7B077A4B
7B077474 33 C0 xor eax,eax
7B077476 C2 1C 00 retd 001C


This looks exactly like the code of AcceptEx (which is officially not supported in Win9x/ME). 0000273D is the code you get from WSALastError (in decimal 10045).

I have modified your code accordingly so it should run with Win9x (attached).

Japheth
Posted on 2002-06-17 02:55:00 by japheth
Thanks, japeth :)
Posted on 2002-06-17 20:24:25 by jademtech
Works great.

I?ve seen its coded in radasm, then radasm is 100% compatiblo with masm32, is it?
Posted on 2002-06-18 12:55:20 by slop