Hi
In need to get data from a wireless sensor network to control Pd patches. The WSN feeds to a database on a server and I need to send queries over the internet to the data server in the form http://ip address/data/location/device/now (or when on a LAN: ip address/data/.../.../now). How do I send the query out of the Pd patch, and how do I get the resulting data back in? (The data comes in this form: 2007-03-22 18:00:01,17,1,0, which timestamp, device ID, data). I would automate the querying with [metro]. [netsend] [comport] [netserver] don¹t seem to apply.
BTW got good results using [comport] on site, picking up from arduinos sending via bluetooth. However, must be done via the server, as data is coming from arduinos, crossbow motes, and proprietary systems and anyway the arduino bluetooth is paired to the server.
Thanks
Stuart
Look at [shell], which can be used to call commands from the system and return their results.
best, d.
Stuart Jones wrote:
In need to get data from a wireless sensor network to control Pd patches. The WSN feeds to a database on a server and I need to send queries over the internet to the data server in the form http://ip address/data/location/device/now (or when on a LAN: ip address/data/.../.../now). How do I send the query out of the Pd patch, and how do I get the resulting data back in? (The data comes in this form: 2007-03-22 18:00:01,17,1,0, which timestamp, device ID, data). I would automate the querying with [metro]. [netsend] [comport] [netserver] don’t seem to apply.
Maybe [netclient], I never got the attached file to work, if you can suss it please let me know. We need to know the local port but [netclient] and [netreceive] don't tell us. If you can get a response back you should be able to hand craft arbitary requests.
On Thu, 22 Mar 2007 18:49:57 +0000 Stuart Jones s.jones@csm.arts.ac.uk wrote:
Hi
In need to get data from a wireless sensor network to control Pd patches. The WSN feeds to a database on a server and I need to send queries over the internet to the data server in the form http://ip address/data/location/device/now (or when on a LAN: ip address/data/.../.../now). How do I send the query out of the Pd patch, and how do I get the resulting data back in? (The data comes in this form: 2007-03-22 18:00:01,17,1,0, which timestamp, device ID, data). I would automate the querying with [metro]. [netsend] [comport] [netserver] don¹t seem to apply.
BTW got good results using [comport] on site, picking up from arduinos sending via bluetooth. However, must be done via the server, as data is coming from arduinos, crossbow motes, and proprietary systems and anyway the arduino bluetooth is paired to the server.
Thanks
Stuart
Umm, isn't the local port always 80 for http, and the remote and local port numbers always identical for tcp? Anyway, [tcpclient] lets you do the important CRLF combo which [netclient] won't, and any http-compliant web server will not reply until it gets that. With [tcpclient] you can do a message like [send 71 69 84 32 104 116 116 112 58 47 47 47 105 110 100 101 120 46 104 116 109 108 13 10( which is the ASCII representation of GET http:///index.html CRLF The string objects I was working on allow you to do this using ordinary text (except that so far you still need to give 13 10 instead of CarriageReturn, LineFeed)
Martin
padawan12 wrote:
Maybe [netclient], I never got the attached file to work, if you can suss it please let me know. We need to know the local port but [netclient] and [netreceive] don't tell us. If you can get a response back you should be able to hand craft arbitary requests.
On Thu, 22 Mar 2007 18:49:57 +0000 Stuart Jones s.jones@csm.arts.ac.uk wrote:
Hi
In need to get data from a wireless sensor network to control Pd patches. The WSN feeds to a database on a server and I need to send queries over the internet to the data server in the form http://ip address/data/location/device/now (or when on a LAN: ip address/data/.../.../now). How do I send the query out of the Pd patch, and how do I get the resulting data back in? (The data comes in this form: 2007-03-22 18:00:01,17,1,0, which timestamp, device ID, data). I would automate the querying with [metro]. [netsend] [comport] [netserver] don¹t seem to apply.
BTW got good results using [comport] on site, picking up from arduinos sending via bluetooth. However, must be done via the server, as data is coming from arduinos, crossbow motes, and proprietary systems and anyway the arduino bluetooth is paired to the server.
Thanks
Stuart
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Martin Peach wrote:
Umm, isn't the local port always 80 for http, and the remote and local
no, who told you that? on most operating system you will need special privileges to open a local port below 1024.
port numbers always identical for tcp?
no, who told you that? only the remote (server) port is fixed. the client usually chooses any free port (in the high range).
Anyway, [tcpclient] lets you do the important CRLF combo which [netclient] won't, and any http-compliant web server will not reply until it gets that.
you can add CRLF with [netclient] as well, but it is far more complicated than with [tcpclient]. on the other side, it is more complicated to generate your query and interpret the response with [tcpclient]
mfga.sdr IOhannes
IOhannes m zmölnig wrote:
Martin Peach wrote:
Umm, isn't the local port always 80 for http, and the remote and local
no, who told you that? on most operating system you will need special privileges to open a local port below 1024.
port numbers always identical for tcp?
no, who told you that? only the remote (server) port is fixed. the client usually chooses any free port (in the high range).
Of course you're right. I was looking at the source code for [tcpclient] (which is mostly the same as [netclient]) and the only port specified is the remote one, which I misunderstood late at night as meaning they were the same. There is no way if knowing what the local port is, it seems, because it's not important, nobody else can connect to it anyhow, under tcp a two-way connection is made, unlike udp. So why does padawan need to know it? Maybe he should be using [tcpserver] instead, or udp?
Anyway, [tcpclient] lets you do the important CRLF combo which [netclient] won't, and any http-compliant web server will not reply until it gets that.
you can add CRLF with [netclient] as well, but it is far more complicated than with [tcpclient]. on the other side, it is more complicated to generate your query and interpret the response with [tcpclient]
The main motivation for me in implementing strings was so I could do a pd-based web server using [tcpserver] without having to use ASCII codes. Haven't had time to even start it yet :(
Martin
mfga.sdr IOhannes
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Fri, 23 Mar 2007 09:57:56 -0400 Martin Peach martin.peach@sympatico.ca wrote:
IOhannes m zmölnig wrote:
Martin Peach wrote:
Umm, isn't the local port always 80 for http, and the remote and local
no, who told you that? on most operating system you will need special privileges to open a local port below 1024.
port numbers always identical for tcp?
no, who told you that? only the remote (server) port is fixed. the client usually chooses any free port (in the high range).
Of course you're right. I was looking at the source code for [tcpclient] (which is mostly the same as [netclient]) and the only port specified is the remote one, which I misunderstood late at night as meaning they were the same. There is no way if knowing what the local port is, it seems, because it's not important, nobody else can connect to it anyhow, under tcp a two-way connection is made, unlike udp. So why does padawan need to know it? Maybe he should be using [tcpserver] instead, or udp?
Good question. That's probably my misunderstanding. Whenever I've written web client code before I've had a handle on all the ports so I assumed I needed that to get the patch I attached to work.
The patch is something I dug out in response to Starts request for a way to use Pd to get data from a webserver.
I think if you can get that patch to return a response from google then everything else should obviously follow. Anybody made it work yet?
Andy
Anyway, [tcpclient] lets you do the important CRLF combo which [netclient] won't, and any http-compliant web server will not reply until it gets that.
you can add CRLF with [netclient] as well, but it is far more complicated than with [tcpclient]. on the other side, it is more complicated to generate your query and interpret the response with [tcpclient]
The main motivation for me in implementing strings was so I could do a pd-based web server using [tcpserver] without having to use ASCII codes. Haven't had time to even start it yet :(
Martin
mfga.sdr IOhannes
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list