Results 1 to 25 of 25

Thread: clear screen via winsock [Resolved]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Resolved clear screen via winsock [Resolved]

    My question is similar to this thread, but does anyone know how to send a "clear screen" command via winsock to a telnet session. So if a user where to type "clear" (without the quotes) itll clear his screen and the pointer will return to the top.
    Last edited by k1ll3rdr4g0n; Jun 12th, 2005 at 12:46 AM.

  2. #2
    Banned ThaRubby's Avatar
    Join Date
    Apr 2005
    Location
    127.0.0.1
    Posts
    356

    Re: clear screen via winsock

    Hmm, you mean "cls" ?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    Forgot to put the thread http://www.vbforums.com/showthread.php?t=10250

    And yes that would be perfect but how would I send that to the client? If I do a winsock1.send data "cls" there only going to see "cls" on the client.

  4. #4
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock

    You would make a trigger for it on the server side.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    Ok I think ima have to put up visuals:
    I want this screen:


    To turn into this:


    Ok, now what command do I have send with winsock to do that to the client.

    winsock1.senddata vbclearscreen ? (I know thats not a vaild command, but I think you all know where Im going with it.)

  6. #6
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock

    What do you plan on using this with?

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    A telnet server.

    Right now all I have is vbCrLf sent so many times to clear the screen, does anyone know of a better way?

  8. #8
    Banned ThaRubby's Avatar
    Join Date
    Apr 2005
    Location
    127.0.0.1
    Posts
    356

    Re: clear screen via winsock

    You would make a trigger for it on the server side.
    Yes you would need like If cls Then Text1.text = ""

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    Quote Originally Posted by ThaRubby
    Yes you would need like If cls Then Text1.text = ""
    O.o? Please note the visual. There is no textboxes. Just a command prompt. .

    Ok heres to clear up any confusion:
    client (command prompt):
    clear{enter}

    server:
    winsock1.senddata vbClearScreen

    client(command prompt):
    {The whole screen is cleared like in my second pic post}.

  10. #10
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock

    Either way, you would still need a trigger. Well, mabye not have to have one, but thats one way to do it. Im not exactly sure what your trying to do, but let me put an example:

    VB Code:
    1. 'This is happening when data is recieved from the client
    2. 'Make sure the data is stored in a variable
    3. If Data = "cls" Then
    4. 'Here you would put what you wanted to happen, so if you
    5. 'wanted a messagebox to appear put msgbox "message"
    6. End If

    Im not quite sure if thats what your looking for though.

  11. #11
    Banned ThaRubby's Avatar
    Join Date
    Apr 2005
    Location
    127.0.0.1
    Posts
    356

    Re: clear screen via winsock

    I dont have a grasp of what your trying to do either. Can you please post the code?

  12. #12
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: clear screen via winsock

    I don't know what you want to do either. Maybe if you posted your code, we could get some idea.

    In the past, using any terminal meant that you would clear your own screen anytime you wanted, by pressing the CLEAR key. Nothing was sent over the line, it was typically the HOME key, which cleared the screen, and moved the cursor to 0,0, line 0, col 0, or the upper left of the screen.

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    Quote Originally Posted by Inuyasha1782
    Either way, you would still need a trigger. Well, mabye not have to have one, but thats one way to do it. Im not exactly sure what your trying to do, but let me put an example:

    VB Code:
    1. 'This is happening when data is recieved from the client
    2. 'Make sure the data is stored in a variable
    3. If Data = "cls" Then
    4. 'Here you would put what you wanted to happen, so if you
    5. 'wanted a messagebox to appear put msgbox "message"
    6. End If

    Im not quite sure if thats what your looking for though.
    I have that allready as a matter of fact I have everything else. You know what a command prompt is right? You know how to work telnet right? Well, what I have done is that my VB program will act as a telnet server using winsock. You do a telnet IP port in the command prompt. Then you start to enter commands in the command prompt. NOT A VB CLIENT PROGRAM!. I was wondering if anyone knew how to clear the screen of a command prompt using winsock. cls would work perfect except I don't know how to send it to the remote computer to where itll execute it, cause if I do a winsock.senddata "cls" itll just send it as text.

    Im trying to figure out how to do a sort of vbClearScreen on a command prompt, to where all I have to do is send a command like winsock1.sendddata vbClearScreen and itll clear the clients (the connected person, to the VB server, using the command prompt and telnet) command prompt.

  14. #14
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock

    So, you are trying to clear the command propt of all text? Or, just exit the prompt?

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    Clear it of all text.

    Code? Fine....

    VB Code:
    1. Private Sub server_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    2. Dim txtin As Integer
    3. Dim x As String
    4. Dim data As String
    5. 'txtin = Val(frmDebug.txtIndex.Text)
    6. server(Index).GetData data
    7. stemp(Index) = data
    8.  
    9. If InStr(1, data, vbCrLf) = 1 Then
    10. x = command(sdata(Index), Index)
    11. sdata(Index) = ""
    12. stemp(Index) = ""
    13. End If
    14.  
    15. sdata(Index) = sdata(Index) & stemp(Index)
    16. End Sub
    17.  
    18. Public Function command(scommand As String, Index As Integer)
    19.  
    20.  
    21. If InStr(1, scommand, "clear") = 1 Then
    22. frmMain.server(Index).SendData vbClearScreen 'this is where Im stuck
    23. End If
    24. End Function
    Last edited by k1ll3rdr4g0n; Jun 11th, 2005 at 10:58 PM.

  16. #16
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: clear screen via winsock

    What kind of control are you writing the text on? You just showed us the winsock control, but not the object in your program. Is it a RTB, or a TEXTBOX or are you drawing it directly on the screen? See where I'm coming from?

  17. #17
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock

    Yea, thats just the winsock. That does not really help us determine what exactly your writing to, or commanding. Post us something about the command prompt.

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    I dont know how else I could explain this. The server is the only thing made in VB. The client is a command prompt. I want the VB server to send a command to the client (command prompt) to clear it self (to clear the command prompt). But, I don't know the command to send to clear the command prompt via winsock. I want to know how to clear the command the command prompt like as if you typed cls, with a server-client opperation setup, where the client is the command prompt, and your using visual basic winsock.

  19. #19
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock

    I really don't know if you can do that. So your trying to send commands from a Vb program to another program on another computer ober winsock? I dont think thats possible, but I could be wrong.

  20. #20

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock

    Quote Originally Posted by Inuyasha1782
    I really don't know if you can do that. So your trying to send commands from a Vb program to another program on another computer ober winsock? I dont think thats possible, but I could be wrong.
    But then how does telnet work.

    Anyways its a dead issue now, I figured it out. It was acctually quite simple to.

  21. #21
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock [Resolved]

    Alright, I wasn't quite clear on what your real issue was. As you can see many of us felt.

  22. #22
    Banned ThaRubby's Avatar
    Join Date
    Apr 2005
    Location
    127.0.0.1
    Posts
    356

    Re: clear screen via winsock [Resolved]

    Least I figured out what he wanted ^.- VB was acting as a telnet server, and he was telneting from cmd prompt to his vb program. He wanted the program to clear the screen the cmd prompt.

  23. #23
    Frenzied Member Inuyasha1782's Avatar
    Join Date
    May 2005
    Location
    California, USA
    Posts
    1,035

    Re: clear screen via winsock [Resolved]

    lol ^^ I had that part down, but Im not really familiar with telnet that much.

  24. #24

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2004
    Posts
    751

    Re: clear screen via winsock [Resolved]

    Quote Originally Posted by ThaRubby
    Least I figured out what he wanted ^.- VB was acting as a telnet server, and he was telneting from cmd prompt to his vb program. He wanted the program to clear the screen the cmd prompt.
    Thank you, at least my typing wasnt in vein. For awhile I thought that I was making no sense what so ever to you guys. .

  25. #25
    Banned ThaRubby's Avatar
    Join Date
    Apr 2005
    Location
    127.0.0.1
    Posts
    356

    Re: clear screen via winsock [Resolved]

    Bealive me you wernt lol, this helped me understand.
    I dont know how else I could explain this. The server is the only thing made in VB. The client is a command prompt. I want the VB server to send a command to the client (command prompt) to clear it self (to clear the command prompt). But, I don't know the command to send to clear the command prompt via winsock. I want to know how to clear the command the command prompt like as if you typed cls, with a server-client opperation setup, where the client is the command prompt, and your using visual basic winsock.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width