mIRC Homepage
Posted By: Zeraphm SOCK Write Queing - 29/06/04 10:34 PM
Hello

I was recently using mIRC to be a link between some software and a datapipe. Basically, I was feeding the software with data from the datapipe using the code below.

Code:
on 1:sockread:dren*:{
  if ($sockerr > 0) { return }
  :nextread
  sockread &drenread
  if ($sockbr == 0) { return }
  sockwrite $sock($sockname).mark &drenread
}


I came up with the error of the queue being full at 16384 bytes. I came up with some solutions but none of them really worked out. So I was wondering if someone could help me with a way to feed the software with the data without any errors. The datapipe is sending at roughly 500K if it helps any.
Posted By: tsoglanos Re: SOCK Write Queing - 30/06/04 09:14 AM
you should check how much info is currently queued by using $sock().sq (send queue) before trying to queue info on a socket.

somthing like this
Code:
  
if ($sock($sockname).sq < 16000) { sockwrite bla bla }

or maby 

if ($sock($sockname).sq > 16000) { return }


becuse the maximum info can be queued is 16384
also you sould wait while there is still info queued in the send buffer before using the sockwrite command again
Posted By: Zeraphm Re: SOCK Write Queing - 30/06/04 03:22 PM
I was thinking about that, but it was my understanding that once I do the sockread and do nothing with it, all the info will be gone. So like if I insert your code at the end, I will do a sockread &drenread and then it will see that the send queue is full and it will return, but than once the on:*:sockread is triggered again, I will do another sockread &drenread and lose all information inside of the previous &drenread
Posted By: Online Re: SOCK Write Queing - 30/06/04 03:31 PM
Try this script,
http://members.lycos.co.uk/onln/files/sockq.txt
© mIRC Discussion Forums