Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: telnet winsock wwwsk34I.dll wwwsk44I.dll
Basically the telnet script is mostly responding WON'T and DON'T to any init sequences it receives.
; Define your variables acct="elmer" pswd="d48ls12W" hostaddr = "www.windowware.com" ; Initialize string for display oline="" ; Display a box to the user BoxOpen("Telnet","Initializing") WinZoom("") ; Load the extender AddExtender("wwwsk44I.dll") ; Telnet Connect socket = sOpen () sConnect (socket, hostaddr, "telnet") ; Wait for the telnet server to respond with the waitfor string waitfor="login:" GoSub WAIT ; Send the user account sSendLine(socket,acct) ; Update the box to notify the user what is happening oline=StrCat(oline,line) BoxText(oline) ; Wait for the telnet server to respond with the waitfor string waitfor="Password:" GoSub WAIT sSendLine(socket,pswd) ; Update the box to notify the user what is happening oline=StrCat(oline,line) BoxText(oline) ; Wait for the telnet server to respond with the waitfor string waitfor="TERM" GoSub WAIT TimeDelay(2) sSendLine(socket,@CRLF) ; HIT ENTER KEY ; Update the box to notify the user what is happening oline=StrCat(oline,line) BoxText(oline) ; Wait for the telnet server to respond with the waitfor string waitfor=" > " ; Wait for greater than symbol GoSub WAIT sSendLine(socket,"who") ; Update the box to notify the user what is happening oline=StrCat(oline,line) BoxText(oline) ; Wait for the telnet server to respond with the waitfor string waitfor=" > " ; Wait for greater than symbol GoSub WAIT sSendLine(socket,"exit") ; Update the box to notify the user what is happening oline=StrCat(oline,line) BoxText(oline) ; Wait for the telnet server to respond with the waitfor string waitfor=Num2Char(10) ; Wait for a linefeed GoSub WAIT ; Update the box to notify the user what is happening oline=StrCat(oline,line) BoxText(oline) Message("",oline) sClose(socket) Exit :WAIT ; Loops collecting data response from server character by character line="" While 1 ; loop until break iacchk=sRecvNum(socket,1) ;Gets one byte of numeric data from a socket. If !iacchk ; zero err=wxGetLastErr() ;Gets the error of the last extender function, if any. If err == @SOK Then Continue Message("Network Error",err) sClose(socket) ; Close socket and exit script Exit EndIf ; Handle results of sRecvNum Switch iacchk Case 255 ; NULL Character command=sRecvNum(socket,1) ; Gets one byte of numeric data from a socket. If command>250 && command<255 ; Handle special characters option=sRecvNum(socket,1) ; Gets one byte of numeric data from a socket. If option; If non zero Send response To SERVER NULL NULL {Option} sSendString(socket,StrCat(Num2Char(255),Num2Char(252),Num2Char(option))) EndIf EndIf If command==255 Then line=StrCat(line,Num2Char(255)) ; Append NULL to line Break Case iacchk ; other char line=StrCat(line,Num2Char(iacchk)) ; Append characters to line Break EndSwitch ; Display line BoxTitle(line) ; looks for line to match your waitfor string, then breaks If StrIndex(line,waitfor,1,@FWDSCAN) Then Break EndWhile Return
Article ID: W12616
Filename: Telnet Connection - Simple Easy Version.txt
File Created: 2011:01:18:15:34:50
Last Updated: 2011:01:18:15:34:50