ops.. you're right, i didn't actually mean the ethernet packet :)
Posted on 2001-11-16 10:21:41 by random
Thomas, Random, hello,

well,
i am having troubles with the sending of the data in non-blocking mode .. i have downloaded Thomas examples, which were very clear :) Thanks Thomas. The best thing for me is that if you can convert your Server1 from blocking to non-blocking!
Cause i don't know whats wrong here. I just can't make my socket send more that 8192 bytes.

Posting some code in here would be useless because i think i am missing the BIG idea.

sorry for the fuss guys.
Posted on 2001-11-17 03:30:22 by Ray
Ray: Although my examples may be useful to you, remember that they are coded in a big hurry lacking good coding style & error checking..
So be careful when copy&pasting :)
I'll rewrite my example in non-blocking mode...

Thomas
Posted on 2001-11-17 03:59:58 by Thomas
Here it is...

Thomas
Posted on 2001-11-17 04:12:04 by Thomas
Thomas,
your examples may luck coding style and error checking ,however, they get exactly to the point :)

Once one gets to understand whats really going on, the rest i think, its minnor details .

Now you understand why i was so eager for that winsock tutorial .

once again, i thank you.


:alright:
Posted on 2001-11-17 05:50:11 by Ray
got it working now :)
but here is another question:

i have a connected socket which is sending to me data.
How can i get the total bytes sent ?
the function ioctlsocket returns the data that can be downloaded that moment, usualy 4-8 kb. correct? at least this is what i am getting.
so, is there a way to get the total length?
Posted on 2001-11-17 15:11:06 by Ray

the function ioctlsocket returns the data that can be downloaded that moment, usualy 4-8 kb. correct? at least this is what i am getting.

Yes that's correct.


so, is there a way to get the total length?

Just add the number of bytes at that moment to a variable everytime you receive data.. But don't use the value of ioctlsocket, use the value returned by recv. Then you're sure you've got the right value. Otherwise it may be wrong when more data becomes available just between the ioctlsocket and the recv.


....
invoke recv, blahblah
add bytesReceived, eax
....

don't forget to initialize bytesReceived to zero before the download.

Thomas
Posted on 2001-11-17 16:06:33 by Thomas
Mmmmhhhhh
my big speed limitation right now is the WriteFile on the client side

on the 10Mbits LAN I can use the full bandwidth, as the limiting factor is the network connection
on the 100Mbits LAN if I disable the write to file function I get around 5MB/s, but if I enable it (and of course I need to if I want to transfer the damn files ;) ) the speed drops to 2.5-3.5MB/s and I can see from my counters (KB/s, bytes lefts) that the stream of data is not continuous but stops during the write to file process

What do you guys think might be a good file IO procedure?
Right now I fill a buffer and dump it when full with WriteFile ... and loop this operation until I transferred the whole file
Note that the file is created WITHOUT any of the attributes like FILE_FLAG_WRITE_THROUGH or FILE_FLAG_NO_BUFFERING.

cheers
Random
Posted on 2001-11-21 10:25:58 by random
Hm, how big is your buffer? You definitely don't want it too small,
as you will loose too much time in ring3->ring0 transitions. But if
you make it too big, it might take too long to transfer your buffer into
the filesystem cache (however that's done). How large is your buffer,
and how do you buffer the data?
Posted on 2001-11-21 10:44:51 by f0dder
This is really funny
I played around it for a little while changing the buffer sizes (fodder, to answer your question I just allocate a buffer with GlobalAlloc,GMEM_FIXED) and I got some strange results

transferring a 100Mb file from A to B reached 4.5Mb/s (almost max out what I can get with my office LAN) using a receive buffer of 256kb.
But when I transfer the very same file from B to A I get only 1.5Mb/s!!! The whole thing is really ... really ... pissing me off !!!

The 2 PCs are different but not that much. Both have W2k PRO installed.
PC A is a DELL Optiplex PIII 800-something Mhz with 256Mb Ram
PC B is IBM Thinkpad T21 PIII 800-something Mhz also w/ 256Mb
I guess a big difference is given by the NIC
PC A has a 3COM 3C920 Integrated
PC B has an Intel PRO 100+ (integrated as well)

and by the HD. The IBM HD appears to be considerably faster in writing

How the hell can I write something that works equally well on all machine without hand-tweaking and fine-tuning each friggin' installation??

misteries

Random
Posted on 2001-11-21 12:48:02 by random
Sounds pretty damn weird :/. Both NICs should be good quality,
and the processors aren't exactly sluggish either... I'm blank :/.
Posted on 2001-11-21 14:03:33 by f0dder
Hmm strange..
The only thing I can think of is that maybe one disk is more fragmented than the other, have you tried defragmenting them?

Thomas
Posted on 2001-11-21 14:23:36 by Thomas
I'm now defragmenting the HD
meanwhile I wrote a quick test showing what I'm doing (it's just some code I ripped out of my program)
Note that both server and client are using blocking sockets (my server will never have more than one client connected, so this is the fastest/easiest solution)

let me know if you get the same wierd results sending the file from A to B and viceversa

Random

ps: another thing ... a file called "transfer.tmp" is created in the client directory and at the end of the transfer is going to be 100Mb ... so watch out your HD space and remember to delete the file ;)
Posted on 2001-11-22 05:45:36 by random
I've done your test, and got totally different results for A->B and B->A, but both computers and harddisks are also quite different so it was not surprising:

comp1: pentium III 550, 128 sd-ram, Seagate 20GB harddisk (ATA/33)

comp2: athlon 1.4Ghz, 256 ddr-ram, IBM Deskstar 40GB harddisk (ATA/100)

Results:

comp1 -> comp2 : 6600 kb/s
comp2 -> comp1 : 2042 kb/s

I also did a local test:

comp1 -> comp1: 810 kb/s (!!!)
comp2 -> comp2: 21898 kb/s

Obviously, comp2 has a much faster harddisk so it's not that strange it performs better. What I did find strange is that comp1 scores so bad on the local test, even worse than comp2->comp1 .. I did that test several times but with the same results.

Thomas
Posted on 2001-11-23 05:43:25 by Thomas