MCCP

 
Post new topic   Reply to topic    mudlab.org Forum Index -> Coding
View previous topic :: View next topic  
Author Message
Corbyn



Joined: 18 Jul 2011
Posts: 3

PostPosted: Mon Jul 18, 2011 11:37 am    Post subject: MCCP Reply with quote

Hi Smile

I've made the start of a simple telnet server, and am having trouble trying to add MCCP. I've looked at a few different implementations, but seem to be missing something...

My send buffers are c++ strings, they are only converted when being used for send().

I'm using a char buffer (cbuff) to convert the IAC WILL MCCP as such:
sprintf(cbuff, "%c%c%c", 255, 251, 86);
and then cbuff gets added to the c++ string send buffer (like any other message would) before being sent to the client.

Trouble is, the clients I've tested with just seem to send back a "V" with no carriage return.

Any ideas as to what I am doing wrong/missing?

Cheers

Corbyn
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Tue Jul 19, 2011 12:34 am    Post subject: Reply with quote

Which client/s did you test with?

GMud's negotiation is broken, for example, and it will actually display 'V' (ASCII character 86) if you send it IAC WILL MCCP.

On the other hand, if your client supports MCCP and it's still doing it, it could be that your mud is discarding nonprintable characters. If that's the case, I'm assuming you don't support any other protocols at this stage? You may want to take a look at my protocol snippet.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Corbyn



Joined: 18 Jul 2011
Posts: 3

PostPosted: Tue Jul 19, 2011 10:09 am    Post subject: Reply with quote

Have tested with tintin++, Mudlet, and just telnet from terminal. However I meant that the message I receive back from the client just puts V into the in-buffer (waiting for a /n or /r before handling).

Yeah don't support any other protocols yet, basically have a socket server so far. And I am disabling some non printable characters from coming in, sorta assumed the client would send back IAC,DO/DONT,86 and a /r or /n.

Will have a good read through your snippet and see how I go.

Thanks Smile

Corbyn
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Tue Jul 19, 2011 11:12 am    Post subject: Reply with quote

Well TinTin++ and Mudlet both support MCCP2, and windows telnet should correctly indicate that it doesn't support it.

However most muds ignore nonprintable characters, so if you send them IAC DO MCCP (or IAC DONT MCCP) they'll strip out the first two bytes and treat the third as regular input. That would result in the behaviour you've described.

What you need to do is check the input for IAC, preferably with a state machine, so that you can read whatever comes after it and react accordingly. You can still strip nonprintable characters from in-band input, but you shouldn't strip them from out-of-band negotiation and subnegotiation sequences.

This is handled by the ProtocolInput() function in my protocol snippet, if you want to see a working example.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Corbyn



Joined: 18 Jul 2011
Posts: 3

PostPosted: Wed Jul 20, 2011 10:12 am    Post subject: Reply with quote

Thanks heaps, I'll have a good read through your snippet and do some testing!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    mudlab.org Forum Index -> Coding All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
BBTech Template by © 2003-04 MDesign