win10
mIRC v7.72 (Fresh install; no coms, dlls, or unrelated scripts)
I cannot reproduce this after testing a veriety of ways. Things I've tried:
Singular sockread calls across multiple events:
on *:SOCKREAD:test-client:{
if ($sockerr) test-stop [CLIENT] SockRead error
sockread 8192 &bvar
}
Multiple sockread calls in the same event
on *:SOCKREAD:test-client:{
if ($sockerr) test-stop [CLIENT] SockRead error
sockread 1024 &bvar
sockread 1024 &bvar
sockread 1024 &bvar
sockread 1024 &bvar
}
Context dependant sockread calls:
on *:SOCKREAD:test-client:{
if ($sockerr) test-stop [CLIENT] SockRead error
sockread 1024 &bvar
while ($sockbr) {
sockread 1024 &bvar
}
}
The script used (sub out the SOCKREAD test-client event):
;; To start the test: /test-start
alias test-start {
socklisten test-listener 1010
echo * [Host] Listening for connections
startclient
;; adjust timer to alter run length
timerteststop 1 15 test-stop
}
alias test-stop {
if ($sock(test-listener)) {
sockclose test-listener
}
if ($sock(test-host)) {
sockclose test-host
}
if ($sock(test-client)) {
sockclose test-client
}
if ($timer(teststop)) {
timerteststop off
}
if ($0) {
echo * $1-
}
else {
echo * Test ended
}
halt
}
; Setup Listener
on *:SOCKLISTEN:test-listener:{
if ($sockerr) test-stop [LISTENER] SockListen error
sockaccept test-host
sockwrite -t test-host str(a, 8192)
}
on *:SOCKCLOSE:test-listener: {
if ($sockerr) test-stop [LISTENER] SockClose error
test-stop [LISTENER] Listener closed
}
/*
** Host/server side of connection
** Attempts to keep the send-buffer at 8kb
*/
on *:SOCKWRITE:test-host:{
if ($sockerr) test-stop [HOST] SockWrite error
var %space = $calc(8192 - $sock($sockname).sq)
if (%space > 0) {
sockwrite -t $sockname $str(a, %space)
}
}
on *:SOCKCLOSE:test-host: {
if ($sockerr) test-stop [HOST] SockClose error
test-stop [HOST] Shutdown: Client disconnected from host
}
/*
Client: Connects to host, reads received data into bvar, then returns
*/
alias -l startclient {
sockopen test-client 127.0.0.1 1010
echo * [Client] Connecting to host...
}
on *:SOCKOPEN:test-client: {
if ($sockerr) test-stop [CLIENT] SockOpen error
echo * [Client] Connected to host.
}
on *:SOCKREAD:test-client:{
if ($sockerr) test-stop [Client] SockRead error
sockread 8192 &mybvar
}
on *:SOCKCLOSE:test-client:{
if ($sockerr) test-stop [Client] SockClose error
test-stop [Client] Connection to host closed
}