mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
Hello to you all

It seems i can't read more then 4096 bytes with sockread command, sending the data to a binvar.
I can make it read less if i use sockread 1024 &binvar

The data is been sent by a browser to mirc, and i have tried several (IE and firefox).

I find this behavior with both mirc 6.35 and latest beta.
Is this the maximum allowed value when reading?

Best Regards

Last edited by tontito; 27/05/10 03:41 PM.
Joined: Dec 2002
Posts: 5,412
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,412
Yes, the maximum number of bytes you can read with /sockread is 4096 bytes. If there is more data to read, you will need to call /sockread again. There is an example on how to do this in the sockets section of the mIRC help file.

Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
Thank you Khaled.

I was hoping i could read a bit more at once, since we can send bigger amounts of bytes.

Basically i was trying to increase the CPU performance of one of my scripts when using hight speed lan connections.

Cheers

Last edited by tontito; 27/05/10 04:46 PM.
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It's not a bug. It's documented. I'm not sure that increasing the size of mIRC's queue will improve "CPU performance" of your script.. it might improve throughput, but that's another issue.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
I could see from the documentation that the default was 4k, not the max.

About the cpu performance, i get mirc to use 40% cpu on a dual core 2.6GHz.
It make more then 45 read each second and maxs at 50 read second making a total of 200kB/s.

When i send data i can make up to 250 sends of 8k (2MB/s)
Case you wounder this addon is a web server, and yes, it doesn't work bad smile

It is not bad, but if i could read 8k each time...
But is there is no chance, it is ok.

Thanks
Best Regards

Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
that sounds more as the HDD being the bottleneck and not the CPU. the reads/writes are what are delaying your script mostly I think.


If it ain't broken, don't fix it!
Joined: Dec 2002
Posts: 5,412
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,412
I have looked through my code for /sockread and it does seem that the 4096 byte limit is arbitrary, since binary variables have no size limit. I need to perform more tests, however if change is robust, the /sockread byte limit will be removed from the next version.

Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
Great news!

Thank you Khaled

Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
Nop, the HD is lagging.

It seems the sockread is more cpu intensive then sockwrite.

But if Kladed makes it possible to use 8k or 16k in the limit, the cpu usage should decrease a lot or at least read much faster, since the TCP will not enter in congestion avoidance at such a low speed.

Lets wait for Kladed tests smile

Thanks for all your feedbacks!

Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
It is working great on 7.05b

thanks Khaled


Link Copied to Clipboard