Subj : Proxy Service Issues
To : Digital Man
From : Drakmir
Date : Fri Oct 07 2005 01:25 am
Re: Proxy Service Issues
By: Drakmir to Digital Man on Thu Oct 06 2005 11:50 pm
I think I have a solution, although the problem is interesting.
I changed the read code to be the following:
if(socket.data_waiting)
{
var numRead = socket.nread;
buf = socket.read();
if (numRead != buf.length)
{
log("2 - " + numRead + " vs. " + buf.length);
}
client.socket.write(buf);
continue;
}
sleep(1);
And noticed that the string being returned from "read" had the wrong number of
bytes occasionally. I assume there are embedded \0 characters in the telnet
responses?
Anyway, switching to the following read code seems to help:
if(client.socket.data_waiting)
{
var numRead = client.socket.nread;
if (numRead >= 512) numRead = 512;