|
|
|
Page 1 of 1
|
[ 4 posts ] |
|
Sending bytes with cURL (I think)
| Author |
Message |
|
kd5crs11
Joined: Feb 09, 2009 Posts: 108
|
 Sending bytes with cURL (I think)
So I've got a system that works with Indigo, SerialBridge, and XBee's (802.15.4) on both ends. Indigo runs an Applescript, which passes 4 bytes to SerialBridge, which sends them out over the Xbee. Works great.
Nowadays they have Xbee wi-fi modules (and the pin-alikes like the WiFly) that join your existing WiFi network. So I was hoping I could cut out a bunch of that complexity and just send those 4 bytes to the WiFly directly from a URL. As far as I can tell, that's what cURL does?
So I've got the WiFly module on my network at 10.0.1.13. It works, I can telnet to it from my Mac. But trying to figure out cURL is like beating my head against a wall. If I want to send these four bytes: 132, 0, 53, 42 to the Wifly at 10.0.1.13, could someone tell me the statement to use?
If cURL is the wrong tool and I should be doing something different, please tell me that too. Tangentially related, is there a way I can send these four bytes through telnet in Terminal? I've tried 132 <return> 0 <return>, etc, and it sends each byte but I guess it is too slow to register on the other end?
Thanks.
|
| Fri Jul 20, 2012 1:12 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6859 Location: Austin, Texas
|
 Re: Sending bytes with cURL (I think)
I'd do it with a python script - it can open a socket and can deal with bytes easily.
_________________ Jay (Indigo Support)
|
| Fri Jul 20, 2012 2:31 pm |
|
 |
|
kd5crs11
Joined: Feb 09, 2009 Posts: 108
|
 Re: Sending bytes with cURL (I think)
Ok, I'll try that. Googling found the following code: - Code: Select all
import socket
# Each address on the Internet is identified by an ip-address # and a port number. robot_ip_address = "192.168.0.12" # Change to applicable robot_port = 3000 # Change to applicable
# Create a socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to somewhere... s.connect((robot_ip_address, robot_port))
# Send one character to the socket s.send('D')
# Close the socket after use s.close()
I'll have to figure out what to do with that.
|
| Fri Jul 20, 2012 4:51 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6859 Location: Austin, Texas
|
 Re: Sending bytes with cURL (I think)
Looks like a good start - Python is really quite straight-forward. And it has a lot of features built-in.
_________________ Jay (Indigo Support)
|
| Fri Jul 20, 2012 5:26 pm |
|
|
|
Page 1 of 1
|
[ 4 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|