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;

           while(numRead > 4)
           {
               buf = client.socket.recvBin(4);
               socket.sendBin(buf, 4);
               numRead -= 4;
           }

           if (numRead > 0)
           {
               buf = client.socket.recvBin(numRead);
               socket.sendBin(buf, numRead);
           }
           continue;
       }

I'll see if that has any weird effects.

I'm signing off now.

Alan

---
� Synchronet � Holodeck One - bbs.holodeckone.com