mIRC Home    About    Download    Register    News    Help

Print Thread
#111599 17/02/05 05:05 AM
Joined: Jan 2005
Posts: 37
S
Scratch Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 37
I am trying to write a simple Telnet server for mIRC by following the original Telnet Protocol RFC, and I need some help...

The Telnet Protocol's RFC says the following:

Quote:
The telnet protocol also specifies various commands that control the method and various details of the interaction between the client and server. These commands are incorporated within the data stream. The commands are distinguished by the use of various characters with the most significant bit set. Commands are always introduced by a character with the decimal code 255 known as an Interpret as command (IAC) character.


My question is:

How do I send a decimal code using sockets?


Here's the code that I am using to send the (IAC) command:

Code:
on *:SOCKLISTEN:telnet:{
sockaccept client
[color:red]sockwrite -n client 255(IAC),251(WILL),3[/color]
}


The problem with the above code is that the '255(IAC),251(WILL),3' is not being interpreted by the Telnet client... Instead, it is appearing on the client terminal as regular text...


What am I doing wrong?

#111600 17/02/05 11:26 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
$chr(255)


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#111601 17/02/05 01:14 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
After all that time, all we get is a "$chr(255)"? Unacceptable!


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#111602 17/02/05 01:18 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
confused HUH? 6 hours 21 minutes isn't THAT long. grin


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#111603 17/02/05 06:05 PM
Joined: Jan 2005
Posts: 37
S
Scratch Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 37
hmm, doesn't seem to work either...

I have this:

Code:
on *:SOCKLISTEN:telnet:{
sockaccept client
sockwrite -n client $chr(255) $+ (IAC) $+ , $+ $chr(251) $+ (WILL) $+ ,3
}


The (IAC) command is still being shown in the Telnet client...

#111604 18/02/05 06:11 PM
Joined: Jan 2005
Posts: 37
S
Scratch Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 37
Nevermind, I think I have figured it out...

#111605 18/02/05 06:11 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
The (IAC) part in the rfc is just a help for the reader, not part of the actual program. What you need to send is ONLY a $chr(255) (that's one byte), just like you send only one character $cr and not "$cr (CARRIAGE RETURN)" (19 characters on quick count)

on *:SOCKLISTEN:telnet:{
sockaccept client
sockwrite -n client $chr(255) $+ $chr(251) $+ your stuff here
}


Link Copied to Clipboard