Enabling MXP on C# code

Posted by Wjmurdick on Fri 02 Oct 2009 10:22 PM — 4 posts, 28,646 views.

#0
Been trying to get MXP enabled on a custom codebase.

Using C# and .NET and I've got a TCPClient and NetworkStream object.

I've tried sending a byte array with the codes (IAC, SB, TELOPT_MXP, IAC, SE) as well as the MXP START codes. But I can't for the life of me get it to enable.

Anyone familiar with C# and the TCPClient/NetworkStream and could give me some pointers?

----------
byte[] buffer = new byte[5];
buffer[0] = User.IAC;
buffer[1] = User.SB;
buffer[2] = (byte)User.TELOPT_MXP;
buffer[3] = User.IAC;
buffer[4] = User.SE;
clientStream.Write(buffer, 0, 5);

buffer = new byte[4];
buffer = encoder.GetBytes(User.ESC + "[6z");
clientStream.Write(buffer, 0, 4);
-----------

Thanks!

Jason (wjmurdick at gmail dot com)
Netherlands #1
Not familiar with MXP (yet), nor with C#, but since I finished implementing a custom telnet stack for my own codebase yesterday, everything is fresh in my mind.

First of all, just saying IAC WILL MXP won't give you MXP if the client isn't written (AND configured) to support it. Using MUSHclient it is really easy to find out. Just go to Edit->Debug Packets, and try connecting to your mud.

You'll want to see your side send IAC WILL MXP (hex: FF FB 5B), and you'll want your client to say (either before or after the WILL, should not matter) IAC DO MXP (hex: FF FD 5B).

At this point, you have a succesful handshake where your server acts as the server. Only at this point can you enable it with the command you mentioned (I can't find anything in the MXP specs to corroborate that command, but that specification document sucks): IAC SB MXP IAC SE (hex: FF FA 5B FF F0).

If you have any other questions, feel free to ask.
Australia Forum Administrator #2
Take a look at this page:

http://www.gammon.com.au/mushclient/addingservermxp.htm

That shows the telnet sequences needed for, first seeing if the client supports MXP, and secondly, turning it on.
#3
Oh, thats where I got the sequences from in the first place. And I know the client I'm testing it with does, its zmud. I'm sending the enable sequence it just isn't working.

Hahah... Turns out I wasn't sending all of the proper sequences... I sent "IAC, SB, TELOPT_MXP, IAC, SE" but then forgot to send "IAC, DO, TELOPT_MXP".

Thanks guys!