I'm trying to fetch the login screen for a MUD and having some issues.
If I use telnet aardmud.org 4000 then it connects and.
nc aardmud.org 4000 produces some junk characters and then displays the login screen. I guess they're some sort of terminal detection or negotiation. tcpdump output doesn't look like telnet negotiation.
Now with js I'm trying this:
var sock = new Socket(SOCK_STREAM);
try { sock.connect('aardmud.org',4000,5) }
catch(e) {
writeln(e);
exit();
}
sock.is_connected show true. So let me check if there's some data waiting for me.
sock.data_waiting shows false
sock.ndata shows 0
sock.poll(0,true) shows the socket is set for reading.
now if I use sock.recvline I get a line of data. So if there's data waiting, why wouldn't data_waiting tell me?
Maybe I am misunderstanding how it all works.
What would be the best way of getting the data upto the point where I am asked to login?
now if I use sock.recvline I get a line of data. So if there's data waiting, why wouldn't data_waiting tell me?
I would expect data_waiting to be true.
It might be best to figure out what that initial handshake is and deal with that first.
Re: Is there a bug in Socket.data_waiting ?
By: Digital Man to nelgin on Wed Feb 21 2024 11:25:52
now if I use sock.recvline I get a line of data. So if there's data waiting, why wouldn't data_waiting tell me?
I would expect data_waiting to be true.
Definately false.
$ cat socktest.js
'use strict';
load("sbbsdefs.js");
load('sockdefs.js');
var sock = new Socket(SOCK_STREAM);
try { sock.connect('aardmud.org',4000,5) }
catch(e) {
writeln(e);
exit();
}
writeln("data? " + sock.data_waiting);
sock.close();
bbs@bbs:/sbbs/xtrn/mudlist/scripts$ jsexec -n socktest.js
data? false
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?
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
INterestingly, it seems vert does telnet negotiation after already sending some text.
I'm trying to fetch the login screen for a MUD and having some issues.
If I use telnet aardmud.org 4000 then it connects and.
nc aardmud.org 4000 produces some junk characters and then displays the login screen. I guess they're some sort of terminal detection or negotiation. tcpdump output doesn't look like telnet negotiation.
Now with js I'm trying this:
var sock = new Socket(SOCK_STREAM);
try { sock.connect('aardmud.org',4000,5) }
catch(e) {
writeln(e);
exit();
}
sock.is_connected show true. So let me check if there's some data waiting for me.
sock.data_waiting shows false
sock.ndata shows 0
sock.poll(0,true) shows the socket is set for reading.
now if I use sock.recvline I get a line of data. So if there's data waiting, why wouldn't data_waiting tell me?
Sysop: | deepend |
---|---|
Location: | Calgary, Alberta |
Users: | 253 |
Nodes: | 10 (0 / 10) |
Uptime: | 52:30:26 |
Calls: | 1,647 |
Files: | 4,011 |
Messages: | 388,104 |