I have a small, probably poorly coded telnet server. You connect, it shows some ansci art and then you just type to chat and it displays your ip address following your message. The problem I'm having is implementing a backspace. When you use backspace in command prompt it simply just moves the cursor back without deleting the character.
I'm using network stream streamreader and streamwriter for the streams. Is there something better than that I should be aware of?
I've pulled some code from a visual basic 6 telnet application and its for a backspace key. My vb is poor now having swapped over to c#.net a long time ago so I don't understand it. Maybe someone just translating it might help me:
DataVal = Asc(DataChar)
DataValSet = ""
For t% = 1 To Len(DataChar)
DataValSet = DataValSet + Str$(Asc(Mid$(DataChar, t%, 1)))
Next t%
If (DataVal = 8 Or DataVal = 127) Then
If Len(LineBuffer(ConnID)) > 0 Then
'echo it back
If UserData(ConnID, 7) <> "1" Then SocketPlayerEcho ConnID, DataChar
LineBuffer(ConnID) = Left$(LineBuffer(ConnID), Len(LineBuffer(ConnID)) - 1)
If UserData(ConnID, 7) <> "1" Then SocketPlayerEcho ConnID, " "
If UserData(ConnID, 7) <> "1" Then SocketPlayerEcho ConnID, DataChar
End If
I no the Dataval = 8 is refering to the backspace key but thats it. Can someone please help me ouT!