Subj : Is there a bug in Socket.data_waiting ? To : nelgin From : Digital Man Date : Wed Feb 21 2024 11:00 pm Re: Is there a bug in Socket.data_waiting ? By: nelgin to Digital Man on Thu Feb 22 2024 12:42 am > Re: Is there a bug in Socket.data_waiting ? > By: Digital Man to nelgin on Wed Feb 21 2024 20:24:51 > > 'use strict'; > load("sbbsdefs.js"); > load('sockdefs.js'); > > var sock = new Socket(); > > if(!sock.connect('vert.synchro.net',23)) { > writeln('Connect failure ' + sock.error_str); > exit(1); > } > > writeln("ic: " + sock.is_connected); > print(JSON.stringify(sock, null, 4)); > > So, if I go with this: > > ic: true > "error_str": "Success", > "is_writeable": true, > "is_writable": true, > "data_waiting": false, > "nread": 0, > > Shouldn't matter if I'm not in a loop right? Yes, it matters. The first time (or several) through the loop, there's not going to be any data waiting. > When I connect the a socket > there's data waiting for me as evidenced by netcat. > > $ nc vert.synchro.net 23 > > Synchronet BBS for Win32 Version 3.20 > Telnet connection from: 192.138.210.158 > Resolving hostname... > 北北北北 北北北' > _ > _ > Synchronet BBS for Win32 Version 3.20 Copyright 2022 Rob Swindell > ^[[?6c^[[49;98R^[[49;1R^C netcat is polling for received data (in a loop, like the example I pasted). That data is not just immediately available upon connection. > INterestingly, it seems vert does telnet negotiation after already sending > some text. Yup. Telnet commands can be sent at any time. -- digital man (rob) This Is Spinal Tap quote #38: Artie Fufkin: I'm not asking, I'm telling with this. Kick my ass. Norco, CA WX: 51.2鳩, 91.0% humidity, 0 mph ESE wind, 0.16 inches rain/24hrs .