RE: RE: [BPQ32] socket interface / python
Thanks John. Adding CMS=1 works.
My test server didn't however so I modified some code that does (I call this command "ECHO" in the config file)
from socket import *
data = clientsock.recv(BUFSIZ)
if not data:
msg = 'echoed:... ' + data
HOST = 'localhost'
PORT = 8050
BUFSIZ = 1024
ADDR = (HOST, PORT)
serversock = socket(AF_INET, SOCK_STREAM)
print 'waiting for connection...'
clientsock, addr = serversock.accept()
clientsock.send("Type 'quit' to return to node\r\n");
print '...connected from:', addr
thread.start_new_thread(handler, (clientsock, addr))
---In BPQ32@yahoogroups.com, <email@example.com> wrote:Sholto,The number after the word HOST is an index into the list of port numbers, soAPPLICATION 4,DEMO,C 2 HOST 0 S
will conenct you to port 23. You needAPPLICATION 4,DEMO,C 2 HOST 1 S
to connect to port 8050.However, this isn't causing the "Error - Invalid Command". i've just checked the code, and the connect to HOST will only work if you also have CMS=1 in your Telnet Server Config. This will be fixed in the next release.73, John
From: BPQ32@yahoogroups.com [mailto:BPQ32@yahoogroups.com] On Behalf Of k7tmg@...
Sent: 02 October 2013 21:30
Subject: [BPQ32] socket interface / python
I'm trying the socket interface you created for linbpq (on Windows).
I added this into the telnet port definition:
CMDPORT 23 8050
My applications look like this:
APPLICATION 4,DEMO,C 2 HOST 0 S
And I have a very simple python program running a "test server" on port 8050. I can telnet to it from the command line but when I type 'demo' into the bpq terminal I get
Error - Invalid Command
Returned to Node IDA105:K7TMG-7
So any clue what I am doing wrong?
Python test server app (I run it in v2.7):
A simple test server
host = 'localhost'
port = 8050
backlog = 5
size = 1024
s = socket.socket(socket .AF_INET, socket.SOCK_STREAM)
client, address = s.accept()
client.send("The quick brown fox jumps over the lazy dog.")