Chapter 3. 5
Isn't connecton socket that returned after accept() on the server is bound to the different( random, like from connect() ) port , so a listening socket can continue use listening port without interference?

As far as I know the server side of the connection always uses the same port as the listening socket. They do not interfere because the client IP & port is in each packet so winsock can distinguish them as being different connections.
The client side does use random ports unless you specify otherwise.

Thomas
Posted on 2002-11-15 14:51:16 by Thomas
Chapter 4 is finished as well, there are now really two versions (asm & C++). The htmlhelp version is updated too.

http://www.madwizard.org/view.php?page=tutorials.contents

Thomas
Posted on 2002-11-17 07:51:22 by Thomas
Chapter 5 is finally finished! Sorry it took so long (last update was november last year :rolleyes: ) but I hope it's worth it. This chapter introduces the I/O models winsock provides. It doesn't teach you how to actually use them yet (first things first..), they will each be explained in a seperate chapter later on.
It's quite a big chapter, even longer than the previous one but it has a lot of fancy images ;) to make understanding this stuff easier.

If you have any feedback please tell me (in this thead is fine), especially if you found parts of it hard to follow or understand. I hope the next chapter will be finished sooner, it will probably be about using blocking sockets (easiest way to start). The chm versions are updated too.



Thanks for waiting,

Thomas
Posted on 2003-03-06 12:54:00 by Thomas
well, just had to say this tutorial is amazing! I have very little experience in network programming and this work of yours has opened a whole new branch of programming for me. not only that, but you filled in some blanks regarding the general background on tcp and udp I wasn't aware that I had, big thanks! can't wait for the next part, although if they are usually 4 months apart I should perhaps not hold my breath ;)

oh and I also liked the layout of your code snippets in the tutorial (line numbers/syntax highlighting colors), is that taken from a text editor you use? if so could you tell me which one?

once again, super tutorial, it's one thing to have a lot of knowledge, it's a totally different thing to be able to pass that knowledge along to others, you are truly one of those few gifted ones!

kind regards, BinarySoup
Posted on 2003-03-07 19:25:16 by BinarySoup
Thanks. These are very helpful. I will look foward to the next chapters =)
Posted on 2003-03-07 19:25:52 by Guy on ASM
BinarySoup has said it all. Great Work :)
Posted on 2003-03-07 19:32:15 by Odyssey
found one small typo:

chapther 5, section 9:
...or just one main thread to handle the user input/GUI and one worker thread that deals will all the socket I/O.


believe it should be:

'deals WITH all the socket I/O.'


awful nitpicking I know, but the tutorial is so good I just can't bear it having typo's!!


kind regards, BinarySoup
Posted on 2003-03-07 21:00:59 by BinarySoup
BinarySoup, Guy on ASM, Odyssey: thanks all :)

Originally posted by BinarySoup
[...]
oh and I also liked the layout of your code snippets in the tutorial (line numbers/syntax highlighting colors), is that taken from a text editor you use? if so could you tell me which one?

No it's a little C++ program I wrote that takes a piece of text and outputs the highlighted html.

found one small typo:

I'll fix it.. thanks :)

Thomas
Posted on 2003-03-08 13:50:43 by Thomas
If this guy ever releases a book I'm gona buy it for sure ... ;)
Posted on 2003-03-08 17:00:12 by code1101
Thomas, you have done the world a service in keeping the tutorial language fairly low-brow ... the information is not exactly hard to find, but it's a rarity to see this stuff set forth with such clarity.
I'm hoping to see a series of accompanying examples in the future.
Keep up the good work !! :)
Posted on 2003-03-08 22:31:23 by Homer
Thomas, as always your tutorials are a pleasure to read :alright:

And thanks for covering overlapped IO as well, I never really took the time to read up on that but it seems interesting enough.

I haven't actually read it all the way through yet, since I'm currently immensely busy with school work, but I just though I'd thank you in advance :)
Posted on 2003-03-09 02:32:13 by Qweerdy
Another one finished. This one shows you how to build up a simple blocking client. Still pretty basic stuff, but you have to start somewhere :)

http://www.madwizard.org/view.php?page=tutorials.contents

Thomas
P.S. Was that fast or what :grin: ?
Posted on 2003-03-17 14:03:51 by Thomas
Keep up the good work. :alright:
Posted on 2003-03-17 14:21:13 by Odyssey
Just wanted to say thanks Thomas, and why isn't this five stars?!
Posted on 2003-03-17 15:26:43 by gorshing
:alright: :alright: :alright: Pls keep this on!! I imagine you writing many more chapters, even covering coding different kinds of server-apps, (in the same great easiest-to-understand and friendly style) like blockingSockets server compatible with many OS, and more winodws specific multi-threaded server! pls keep it up! A thousand thumbs up!
Posted on 2003-03-17 21:33:20 by david
Hello Thomas,

I just want to say thank you not just for your great Winsock tutorials, but for all your posts on this messageboard, you have helped give me and probably hundreds of other people a good start in understanding Winsock...

One thing, ive just had a quick look over the source code to part 6 of your tutorial and there seems to be an error in the main proc code-:

; Check if major version (low byte) is at least REQ_WINSOCK_VER
mov byte ptr ,REQ_WINSOCK_VER <------SHOULD BE CMP
mov ecx, offset g_errVersion
jb _error_cleanup

also you have given the RequestHeaders proc the title ; <FillSockAddr>

....its probably cos you tried to write it as fast as you can for all us impatient people :grin:

One more thing (then i'll stop bugging you!)

Its interesting your use of ebx and esi, you use them through some api calls, so i guess the Winsock api doesnt destroy ebx,esi and probably edi?

I know the windows api expects these not to be changed in our call backs, but i didnt know that the windows api leaves them intact, is this true for all the windows api routines? can i allways rely on ebx,esi,edi not being changed?

This would be a very usefull thing....

Kind Regards,
Lennon.
Posted on 2003-03-19 12:58:34 by Lennon
Originally posted by Lennon
I just want to say thank you not just for your great Winsock tutorials, but for all your posts on this messageboard, you have helped give me and probably hundreds of other people a good start in understanding Winsock...

One thing, ive just had a quick look over the source code to part 6 of your tutorial and there seems to be an error in the main proc code-:

; Check if major version (low byte) is at least REQ_WINSOCK_VER
mov byte ptr ,REQ_WINSOCK_VER <------SHOULD BE CMP
mov ecx, offset g_errVersion
jb _error_cleanup

also you have given the RequestHeaders proc the title ; <FillSockAddr>

Oops, you're totally right :) Thanks..

....its probably cos you tried to write it as fast as you can for all us impatient people :grin:

I sure did :)

One more thing (then i'll stop bugging you!)

Its interesting your use of ebx and esi, you use them through some api calls, so i guess the Winsock api doesnt destroy ebx,esi and probably edi?

I know the windows api expects these not to be changed in our call backs, but i didnt know that the windows api leaves them intact, is this true for all the windows api routines? can i allways rely on ebx,esi,edi not being changed?


Yes the windows API will never touch them. C++ compilers also assume they won't so you can safely rely on this.

Thomas
Posted on 2003-03-19 13:15:36 by Thomas
Thats great thank you thomas...
Posted on 2003-03-19 14:12:07 by Lennon
Hey Thomas,
It Took you FOREVER man!:tongue:
Posted on 2003-04-05 09:31:49 by Ray
A blocking server example this time..

http://www.madwizard.org/view.php?page=tutorials.networking.contents&lang=asm

(Yes I'm still updating the tutorial ;))

Thomas
Posted on 2003-08-01 16:50:29 by Thomas