Thread: telnet server, how to program a backspace

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    23

    Question telnet server, how to program a backspace

    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:
    Code:
    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!

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    That's Visual Basic, not C#.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    23
    Quote Originally Posted by rags_to_riches View Post
    That's Visual Basic, not C#.
    No kidding, maybe you should read the question next time.

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    23
    I think what I want to do is create connection where the buffer is read before its even sent to the server. Are there any other ways instead of networkstream and streamreader?

  5. #5
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by Mastermosley View Post
    No kidding, maybe you should read the question next time.
    Perhaps you should pull your head out of your ass, stop being suck a ........ing jackass and look at the name of the forum in which you posted this, as well as the general name of the URL.

    C PROGRAMMING.

    Where the ........ did you read VB?
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  6. #6
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Quote Originally Posted by IceDane View Post
    Perhaps you should pull your head out of your ass, stop being suck a ........ing jackass and look at the name of the forum in which you posted this, as well as the general name of the URL.

    C PROGRAMMING.

    Where the ........ did you read VB?
    He is looking for a C# solution. Where else should he post but in a C# forum?

    Watch your language. Consider this a formal warning.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Chat Program Help?
    By Paul22000 in forum Networking/Device Communication
    Replies: 9
    Last Post: 02-10-2009, 12:35 AM
  3. Server Architecture
    By coder8137 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-29-2008, 11:21 PM
  4. Telnet Server
    By rdnjr in forum Linux Programming
    Replies: 4
    Last Post: 12-05-2002, 11:27 AM