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.
Printable View
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.
Hmm, you mean "cls" ?
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.
You would make a trigger for it on the server side.
Ok I think ima have to put up visuals:
I want this screen:
http://img196.echo.cx/img196/6345/16pe2.th.gif
To turn into this:
http://img245.echo.cx/img245/1682/22rz.th.gif
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.)
What do you plan on using this with?
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?
Yes you would need like If cls Then Text1.text = ""Quote:
You would make a trigger for it on the server side.
O.o? Please note the visual. There is no textboxes. Just a command prompt. :ehh: .Quote:
Originally Posted by ThaRubby
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}.
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:
'This is happening when data is recieved from the client 'Make sure the data is stored in a variable If Data = "cls" Then 'Here you would put what you wanted to happen, so if you 'wanted a messagebox to appear put msgbox "message" End If
Im not quite sure if thats what your looking for though.
I dont have a grasp of what your trying to do either. Can you please post the code?
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.
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.Quote:
Originally Posted by Inuyasha1782
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.
So, you are trying to clear the command propt of all text? Or, just exit the prompt?
Clear it of all text.
Code? Fine....
VB Code:
Private Sub server_DataArrival(Index As Integer, ByVal bytesTotal As Long) Dim txtin As Integer Dim x As String Dim data As String 'txtin = Val(frmDebug.txtIndex.Text) server(Index).GetData data stemp(Index) = data If InStr(1, data, vbCrLf) = 1 Then x = command(sdata(Index), Index) sdata(Index) = "" stemp(Index) = "" End If sdata(Index) = sdata(Index) & stemp(Index) End Sub Public Function command(scommand As String, Index As Integer) If InStr(1, scommand, "clear") = 1 Then frmMain.server(Index).SendData vbClearScreen 'this is where Im stuck End If End Function
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?
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.
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.
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.Quote:
Originally Posted by Inuyasha1782
Anyways its a dead issue now, I figured it out. It was acctually quite simple to.
Alright, I wasn't quite clear on what your real issue was. As you can see many of us felt.
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. :bigyello: :bigyello: :bigyello:
lol ^^ I had that part down, but Im not really familiar with telnet that much.
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. :p .Quote:
Originally Posted by ThaRubby
Bealive me you wernt lol, this helped me understand.
Quote:
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.