Problem met receiving telnet commands in Openremote

Begonnen von Guest, 04 Februar 2011, 14:09:46

Vorheriges Thema - Nächstes Thema

Guest

Originally posted by: <email address deleted>

Jelle  are trying to let Openremote talk to the FHEM telnet interface
for switching lights and so on.
In doing so we've found a (possible) issue in the telnet service
inside fhem.

It started out with the following post in the Openremote fora:
http://www.openremote.org/pages/viewpage.action?pageId=15532168&focusedCommentId=15532199#comment-15532199

This evolved in the following topic:
http://www.openremote.org/pages/viewpage.action?pageId=15532042&focusedCommentId=15532236#comment-15532236

@Devteam: is this something that would/could easily be fixed?

In the meanwhile the programming for supporting telnet in OR telnet
came to a boost and is getting to a point where intergration between
Openremote and FHEM is very near.
http://www.openremote.org/display/forums/Telnet+Status+Read+Implemented?focusedCommentId=15532293&#comment-15532293

Hope to see your repons

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

rudolfkoenig

                                                   

> @Devteam: is this something that would/could easily be fixed?

I assume that it has to do with a missing response (prompt?) after you issue a
command. This is on purpose to ease automatic parsing of a response.  If you
wish for a prompt, then issue an empty first, as it is described in in
http://fhem.de/commandref.html#intro
As an alternative see the minimalistic "Client code" in fhem.pl

If I'm wrong, then please be kind and summarize the problem, as I then obiously
had problems in seeing it in your discussion.


> In the meanwhile the programming for supporting telnet in OR telnet
> came to a boost and is getting to a point where intergration between
> Openremote and FHEM is very near.

The OR homepage looks very nice :)

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

Your assumption was correct this is indeed (in short terms) about the
response prompt.
The problem is at the moment that issuing a single or is not
directly possible since you are issuing a complete command directly after
connecting.
I looked through the docs but i couldn't find a possibility to directly
acquire a fhem> prompt.... is there a way without sending a NL first?

OR is a great project and i would encourage everybody to take a look. It's
not user ready but at this pase it will be within a year orso.

As an impression i included a screenshot of a Universal Remote interface i
designed. All buttons can be assigned a command, navigation, or reading a
specific sensor.

[image: Selection_028.png]

On Fri, Feb 4, 2011 at 5:15 PM, Rudolf Koenig wrote:

> > @Devteam: is this something that would/could easily be fixed?
>
> I assume that it has to do with a missing response (prompt?) after you
> issue a
> command. This is on purpose to ease automatic parsing of a response.  If
> you
> wish for a prompt, then issue an empty first, as it is described in in
> http://fhem.de/commandref.html#intro
> As an alternative see the minimalistic "Client code" in fhem.pl
>
> If I'm wrong, then please be kind and summarize the problem, as I then
> obiously
> had problems in seeing it in your discussion.
>
>
> > In the meanwhile the programming for supporting telnet in OR telnet
> > came to a boost and is getting to a point where intergration between
> > Openremote and FHEM is very near.
>
> The OR homepage looks very nice :)
>
> --
> Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM
> users beigetreten sind.
> Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
> E-Mail an fhem-users@googlegroups.com.
> Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
> fhem-users+unsubscribe@googlegroups.com
> .
> Besuchen Sie die Gruppe unter
> http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu
> erhalten.
>
>

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

Ok kai,

I think you are not understanding the issue here. It's not that FHEM is not
working, it works as designed. The problem is that Openremote is expecting a
(control/innitial) prompt to show that the innitial (telnet) connection is
established. Without returning the "fhem>" prompt OR doesn't know that the
connection is there.

So to put it as simple as i can: I (as in we) would like to know if its
possible (with a code mod or something else) to receive a (initial) control
prompt directly after the connection is esablished without hitting enter to
push a . This will make intergration waaaaaaay more easy and more
compatible.

I hope i made it clear this time why i/we would like to fix this so we can
integrate FHEM and OR.

So i send a big please from here.





On Sat, Feb 5, 2011 at 10:45 AM, Kai 'wusel' Siering > wrote:

> Hi,
>
> Am 05.02.2011 09:42, schrieb Ernst Cozijnsen:
>
>  ok normally when a (telnet) session is initiated you first get the:
>>
>> SYN-->ACK-->SYNACK for the TCP session to be established.
>>
>> then
>>
>> Directly after the SYNACK the session is established and telnet responds
>> with a prompt to let the session know commands can be executed.
>>
> [...]
>
> There is no fancy protocol in place on FHEM's "control port".
>
> If the connection is established, you are good to go, i. e. send you
> commands to FHEM. It might or might not process them any time soon, because
> of the single threaded nature of how things are handled in FHEM, but anyway:
> as soon as the TCP connection is established, FHEM in priciple listens for
> your FHEM commands on that connection.
>
> There is no initial prompt, like the banners received with SMTP or FTP,
> it's more like HTTP -- you open the connection, you tell the server what it
> is it should do, the server responds. You can repeat this step, or just
> close the connection. It's pretty simple.
>
> wusel@uu2133:~$ (echo "list" ; sleep 10) | nc my-fhem.local 7072
>
> Type list for detailed info.
>  FHZ1                 ()
>
> _internal_:
>  global               ()
>
> CUL:
>  CUL                  (disconnected)
>  CUN                  (disconnected)
>
> FHEMWEB:
>  WEB                  (Initialized)
> [...]
>
> There is no need for a banner, prompt or whatever, it "just works" ;)
>
> Hope that helps,
>                        kai
>
> --
> Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM
> users beigetreten sind.
> Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
> E-Mail an fhem-users@googlegroups.com.
> Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
> fhem-users+unsubscribe@googlegroups.com
> .
> Besuchen Sie die Gruppe unter
> http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu
> erhalten.
>
>

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

OK, thanks this helps a lot more. I was under the impression that it was
telnet based and not socket based. (more in like telnet socket).
Sorry for the mis interpretation here. My bad.

The reason why i was questioning the telnet part is that we used a simple
socket to send over the commands and FHEM was not reacting here.

What happened is that i decoded the TCP stream on the FHEM side and i saw
the command "set Stalamp_KL on" comming in on port 7072 but when i set the
verbose level to 5 i dont see the command comming into the logs.

What would/could be going wrong here?

2011/2/5 Rudolf Koenig

> > I hope this explains a bit better why the prompt is helpfull in this. Or
> > other sugesstions are also more than welcome.
>
> I'm sorry to say, but fhem does not implement any telnet protocol.  It
> happens
> that a telnet client can be misused to send tty data to a "simple" TCP/IP
> socket, and this feature is used by fhem.
>
> Please use a plain socket library while talking to fhem and not a telnet
> library.
>
> --
> Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM
> users beigetreten sind.
> Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
> E-Mail an fhem-users@googlegroups.com.
> Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
> fhem-users+unsubscribe@googlegroups.com
> .
> Besuchen Sie die Gruppe unter
> http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu
> erhalten.
>
>

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

the only thing i see in the fhem logfile is:

2011.02.05 17:57:07 4: Connection accepted from 192.168.10.108:46607

thats it.

On Sat, Feb 5, 2011 at 5:56 PM, Ernst Cozijnsen
wrote:

> OK, thanks this helps a lot more. I was under the impression that it was
> telnet based and not socket based. (more in like telnet socket).
> Sorry for the mis interpretation here. My bad.
>
> The reason why i was questioning the telnet part is that we used a simple
> socket to send over the commands and FHEM was not reacting here.
>
> What happened is that i decoded the TCP stream on the FHEM side and i saw
> the command "set Stalamp_KL on" comming in on port 7072 but when i set the
> verbose level to 5 i dont see the command comming into the logs.
>
> What would/could be going wrong here?
>
> 2011/2/5 Rudolf Koenig
>
>> > I hope this explains a bit better why the prompt is helpfull in this. Or
>>
>> > other sugesstions are also more than welcome.
>>
>> I'm sorry to say, but fhem does not implement any telnet protocol.  It
>> happens
>> that a telnet client can be misused to send tty data to a "simple" TCP/IP
>> socket, and this feature is used by fhem.
>>
>> Please use a plain socket library while talking to fhem and not a telnet
>> library.
>>
>> --
>> Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM
>> users beigetreten sind.
>> Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
>> E-Mail an fhem-users@googlegroups.com.
>> Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
>> fhem-users+unsubscribe@googlegroups.com
>> .
>> Besuchen Sie die Gruppe unter
>> http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu
>> erhalten.
>>
>>
>

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

Am 05.02.2011 17:30, schrieb Ernst Cozijnsen:

> I think you are not understanding the issue here. It's not that FHEM is not working, it works as designed.

Yepp.

> The problem is that Openremote is expecting a (control/innitial) prompt to show that the innitial (telnet) connection is established.

And as I pointed out, that's simply not the way FHEM work on it's socket "interface". So, the assumption of OR when talking to FHEM's socket is wrong, it should consider not expect any protocol, prompt, whatsoever.

Changing the behaviour of FHEM in this respect might break other tools talking to FHEM happily already. (If you expect the command's output but now get "FHEM> " first, this usually will upset existing parsers.)

And, frankly, although I haven't looked into OR yet, a don't see why there should be a problem to implement a simple socket interface, which would enable OR to talk to just any service, if connected to a propper parser for the "language" the socket's owner talks. This would, e. g., open up getting data from web servers as well, plain and simple:

wusel@death:~$ (echo "GET /~wusel/digitemp.out") | nc -q 5 azrael.uu.org 80
1225494542 Verl_K-10   23.19
wusel@death:~$ (echo "get CUL version") | nc -q 5 fhem.local 7072
CUL version => V 1.35 CUL868

Simple. Versatile. I like it ;)

> I hope i made it clear this time why i/we would like to fix this so we can integrate FHEM and OR.

Still, I don't think there is much "to fix", and fixing it in the way you suggest might (IMO: will) break existing tools talking to FHEM already. I could think of a config option, but this won't solve much; existing frontends may still not expect an initial prompt, so it would be an OR-or-non-OR-mode switch, actually, which doens't seem to make much sense to me.

Is there really no way to just talk to a socket interface (like any HTTP server) within OR -- and no way of simply inventing that?
         kai

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

Kai,

Rudolf mailed me the following 5 mails back:

>I'm sorry to say, but fhem does not implement any telnet protocol.  It
happens
>that a telnet client can be misused to send tty data to a "simple" TCP/IP
>socket, and this feature is used by fhem.
>Please use a plain socket library while talking to fhem and not a telnet
>library.

As i answered i didn't know that telnet was not implemented as a protocol in
whole but that it was only (mis)used as to executing commands to a socket.
Are you seeing the picture here? My assumption was wrong.

So... that said :

I tried using a normal socket for sending the commands but the only thing i
see in the fhem logfiles @ verbose 5 is:

"2011.02.05 17:57:07 4: Connection accepted from 192.168.10.108:46607"

When decoding the tcpdump stream on port 7072 i see the command comming in
but nothing is executed.

Maybe you would like to tell me how to debug this further, because in all my
stupidness i just cant find it.



On Sat, Feb 5, 2011 at 10:02 PM, Kai 'wusel' Siering > wrote:

> Am 05.02.2011 17:30, schrieb Ernst Cozijnsen:
>
>
>  I think you are not understanding the issue here. It's not that FHEM is
>> not working, it works as designed.
>>
>
> Yepp.
>
>
>  The problem is that Openremote is expecting a (control/innitial) prompt to
>> show that the innitial (telnet) connection is established.
>>
>
> And as I pointed out, that's simply not the way FHEM work on it's socket
> "interface". So, the assumption of OR when talking to FHEM's socket is
> wrong, it should consider not expect any protocol, prompt, whatsoever.
>
> Changing the behaviour of FHEM in this respect might break other tools
> talking to FHEM happily already. (If you expect the command's output but now
> get "FHEM> " first, this usually will upset existing parsers.)
>
> And, frankly, although I haven't looked into OR yet, a don't see why there
> should be a problem to implement a simple socket interface, which would
> enable OR to talk to just any service, if connected to a propper parser for
> the "language" the socket's owner talks. This would, e. g., open up getting
> data from web servers as well, plain and simple:
>
> wusel@death:~$ (echo "GET /~wusel/digitemp.out") | nc -q 5 azrael.uu.org80
> 1225494542 Verl_K-10   23.1
> wusel@death:~$ (echo "get CUL version") | nc -q 5 fhem.local 7072
> CUL version => V 1.35 CUL868
>
> Simple. Versatile. I like it ;)
>
>
>  I hope i made it clear this time why i/we would like to fix this so we can
>> integrate FHEM and OR.
>>
>
> Still, I don't think there is much "to fix", and fixing it in the way you
> suggest might (IMO: will) break existing tools talking to FHEM already. I
> could think of a config option, but this won't solve much; existing
> frontends may still not expect an initial prompt, so it would be an
> OR-or-non-OR-mode switch, actually, which doens't seem to make much sense to
> me.
>
> Is there really no way to just talk to a socket interface (like any HTTP
> server) within OR -- and no way of simply inventing that?
>
>                        kai
>
> --
> Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM
> users beigetreten sind.
> Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
> E-Mail an fhem-users@googlegroups.com.
> Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
> fhem-users+unsubscribe@googlegroups.com.
> Besuchen Sie die Gruppe unter
> http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu
> erhalten.
>
>

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

rudolfkoenig

                                                   

> What would/could be going wrong here?

I can imagine that the socket buffer on the OR side was not flushed. I think
experimenting with some shell commands (like proposed by Kai) would help
pinpoint the problem.

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

Hi,

Am 06.02.2011 08:46, schrieb Ernst Cozijnsen:

> I tried using a normal socket for sending the commands but the only thing i see in the fhem logfiles @ verbose 5 is:
>
> "2011.02.05 17:57:07 4: Connection accepted from 192.168.10.108:46607 <http://192.168.10.108:46607/>"
>
> When decoding the tcpdump stream on port 7072 i see the command comming in but nothing is executed.
>
> Maybe you would like to tell me how to debug this further, because in all my stupidness i just cant find it.

As Rudolf already suggested, you might not have flushed you buffer or not have finished your command by an end-of-line-character:

wusel@uu2133:~$ echo -n "get CUN version" | nc -q 5 fhem 7072
wusel@uu2133:~$ echo "get CUN version" | nc -q 5 fhem 7072
CUN version => V 1.31.4 CUN
wusel@uu2133:~$

Unless the command is sent to FHEM's socket with propper line termination ("\n"), which is inhibited on the first line by "-n", FHEM's parser won't read it. IIRC this socket input is just fed into a normal command _line_ parser internally, so no (terminated) line, no command understood.

Try to make sure you send a command _line_ to FHEM's socket, like in the second case above ("get CUN version\n" is sent to FHEM's socket), then it should work.

FTR:

wusel@uu2133:~$ echo -n "get CUN version" | xxd
0000000: 6765 7420 4355 4e20 7665 7273 696f 6e    get CUN version
wusel@uu2133:~$ echo "get CUN version" | xxd
0000000: 6765 7420 4355 4e20 7665 7273 696f 6e0a  get CUN version.

HTH,
         kai

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

rudolfkoenig

                                                   

> I looked through the docs but i couldn't find a possibility to directly
> acquire a fhem> prompt.... is there a way without sending a NL first?

No. If you really need it (still cant imagine why), you can issue the command
as

  { $client{$cl}{prompt} = 1;; fhem("...actual fhem command") }

I hope you can use the inform command to get a notification if something has
changed on the fhem side.

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

ok normally when a (telnet) session is initiated you first get the:

SYN-->ACK-->SYNACK for the TCP session to be established.

then

Directly after the SYNACK the session is established and telnet responds
with a prompt to let the session know commands can be executed.
The problem lies here. Because FHEM doesn't respond with a prompt the telnet
session on the other side doesn't know if the (telnet)session has been
established.
We tried this by pointing the session to another port which houses a another
service ( we used http 8080).
In the responds (without the prompt) the reply on both the FHEM port 7072
and the http port 8080 is the same and the sender cannot recognize the
session and times out.

I hope this explains a bit better why the prompt is helpfull in this. Or
other sugesstions are also more than welcome.

the " { $client{$cl}{prompt} = 1;; fhem("...actual fhem command") }"
wouldn't be a help in this because initiating the connection at first hand
is the issue here.

Regards,

Ernst

2011/2/5 Rudolf Koenig

> > I looked through the docs but i couldn't find a possibility to directly
> > acquire a fhem> prompt.... is there a way without sending a NL first?
>
> No. If you really need it (still cant imagine why), you can issue the
> command
> as
>
>  { $client{$cl}{prompt} = 1;; fhem("...actual fhem command") }
>
> I hope you can use the inform command to get a notification if something
> has
> changed on the fhem side.
>
> --
> Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM
> users beigetreten sind.
> Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
> E-Mail an fhem-users@googlegroups.com.
> Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
> fhem-users+unsubscribe@googlegroups.com
> .
> Besuchen Sie die Gruppe unter
> http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu
> erhalten.
>
>

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

rudolfkoenig

                                                   

> I hope this explains a bit better why the prompt is helpfull in this. Or
> other sugesstions are also more than welcome.

I'm sorry to say, but fhem does not implement any telnet protocol.  It happens
that a telnet client can be misused to send tty data to a "simple" TCP/IP
socket, and this feature is used by fhem.

Please use a plain socket library while talking to fhem and not a telnet
library.

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.

Guest

Originally posted by: <email address deleted>

Hi,

Am 05.02.2011 09:42, schrieb Ernst Cozijnsen:
> ok normally when a (telnet) session is initiated you first get the:
>
> SYN-->ACK-->SYNACK for the TCP session to be established.
>
> then
>
> Directly after the SYNACK the session is established and telnet responds with a prompt to let the session know commands can be executed.
[...]

There is no fancy protocol in place on FHEM's "control port".

If the connection is established, you are good to go, i. e. send you commands to FHEM. It might or might not process them any time soon, because of the single threaded nature of how things are handled in FHEM, but anyway: as soon as the TCP connection is established, FHEM in priciple listens for your FHEM commands on that connection.

There is no initial prompt, like the banners received with SMTP or FTP, it's more like HTTP -- you open the connection, you tell the server what it is it should do, the server responds. You can repeat this step, or just close the connection. It's pretty simple.

wusel@uu2133:~$ (echo "list" ; sleep 10) | nc my-fhem.local 7072

Type list for detailed info.
   FHZ1                 ()

_internal_:
   global               ()

CUL:
   CUL                  (disconnected)
   CUN                  (disconnected)

FHEMWEB:
   WEB                  (Initialized)
[...]

There is no need for a banner, prompt or whatever, it "just works" ;)

Hope that helps,
         kai

--
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe FHEM users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine E-Mail an fhem-users@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an fhem-users+unsubscribe@googlegroups.com.
Besuchen Sie die Gruppe unter http://groups.google.com/group/fhem-users?hl=de, um weitere Optionen zu erhalten.