How to mimic telnet session

RGould8 at aol.com RGould8 at aol.com
Mon Dec 29 11:50:16 EST 2003


I've been searching the Revolution archives, and I  think I'm close, 
but I need some assistance figuring out what I'm  missing.  

Basically, I need to mimic a telnet session in  Revolution.  
I need to send text commands to a server on the internet  via port 7777, 
and receive the data that comes back.


If I were  doing this manually, I'd type:

telnet dins.gte.net 7777

and then  type "cmd=getAccessType"

and then the server responds  with

cmd=getAccessType&errorCode=NOERROR&count=7&1=28.8K&2=33.6K&3=33.6K,  
ISDN&4=33.6K, ISDN, V.90&5=33.6K, V.90&6=ISDN  Only&7=V.90


(you can try this as well, if you're on a live  connection)



Can anyone tell me what I'm missing in my code?   
When I click the button, it seems to send successfully, but I get nothing  
back...


on mouseUp
open socket "dins.gte.net:7777"  
write "cmd=getAccessType"  & CRLF to socket  "dins.gte.net:7777" with message 
"callbackmsg"
wait 3  seconds
read from socket "dins.gte.net:7777" for 80 with message  "gotData"
close socket "dins.gte.et:7777"
end  mouseUp


on callbackmsg data 
put "callback (the result) = "  & the result
end callbackmsg

on socketError
answer "got  an error"
end socketError

on gotData
put "databack (the  result) = " & the result
end  gotData






More information about the Use-livecode mailing list