Telnet

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
mk_63
Posts: 1
Joined: Mon Feb 17, 2020 10:53 pm

Telnet

Post by mk_63 » Mon Feb 17, 2020 11:13 pm

I have a problem to establish a telnet session in livecode. I have to connect to a Industrial Machine, that works as a Telnet Server, without Login or Password. I can connect to this machine on a telnet session in Windows 10 and win 7. After connecting the machine answers only with the prompt (>)

I tried this, and a lot of other codesnipets I found on this forum- alwas the same effect: i get no result on open socket! I also get no error message. The Result is empty.

Have anyone an Idea?
here the Code i tried:
put "IP:Port" into mySock
open socket to mySock
put the result into rslt
if rslt is not empty then
write "helo" to socket mySock
read from socket mySock with msg "msgReceived"
else
beep
answer error rslt
-- doesn't matter if socket is already closed
close socket mySock
end if The answer statement displaed an empty Message Box.
IP Adresse tw durch IP:Port ersetzt weil sonst post nicht möglich!

THX for your help

MaxV
Posts: 1577
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Telnet

Post by MaxV » Tue Feb 18, 2020 6:12 pm

Probably this is the code you need:

########CODE to copy and paste with your mouse#######
open socket to "192.168.1.5:23" with message "clientConnected"

on clientConnected pSocket
write "hello world! I'm talking to the server" & return to socket pSocket
read from socket pSocket until return
put "The rever replied: " & it
close socket pSocket
end clientConnected
########END OF CODE generated by this livecode app: http://tinyurl.com/j8xf3xq ########
########Code tested with livecode 9.6.0-dp-2########
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”