View unanswered posts | View active topics It is currently Wed Jun 19, 2013 8:32 pm



Reply to topic  [ 4 posts ] 
 Sending bytes with cURL (I think) 
Author Message

Joined: Feb 09, 2009
Posts: 108
Post 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
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6859
Location: Austin, Texas
Post 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)
Image


Fri Jul 20, 2012 2:31 pm
Profile WWW

Joined: Feb 09, 2009
Posts: 108
Post 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
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6859
Location: Austin, Texas
Post 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)
Image


Fri Jul 20, 2012 5:26 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.