Shop OBEX P1 Docs P2 Docs Learn Events
How to initiate a TCP/IP connection, or send an HTTP GET request — Parallax Forums

How to initiate a TCP/IP connection, or send an HTTP GET request

MaxMax Posts: 13
edited 2006-09-20 21:30 in BASIC Stamp
Hey guys. I'm trying to get two BASIC stamps to communicate with each other over the local internet on my college campus. I've been having trouble Googling resources for this kind of thing. I was going to use a Lantronix WiMicro, but the distributor crapped out and never shipped them. So, I am connecting both stamps to computers running Apache and PHP.

It's pretty easy to have PHP initiate a connection to the stamp based on an HTTP request, because you can just have PHP execute a shell command using `s. What I am stumped on is having the stamp itself initiate a TCP/IP connection!

I'm trying to figure out Serproxy, but there isn't really any documentation. Also, it seems like Serproxy might not be able to initiate TCP/IP connections based on serial activity... is that right? I'm looking at PHP Serial extension too, but I'm just not sure if I have the time to set it up.

All I need to do is for each computer to have a program listening for activity on the serial port, and to send a really simple TCP/IP packet to a specific IP address, generated by the serial activity.

Any ideas?

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-09-19 18:40
    A product I really enjoy is the iPocket232, it's a RS-232 to TCP connector that can simply plug into the programming port for transparent pass through of data, and a lot of other great features.

    http://www.precidia.com/products/ipocket_232.html

    A couple years ago there were around $79, not sure on current prices.
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
  • MaxMax Posts: 13
    edited 2006-09-19 18:48
    Martin, the iPocket seems like a great idea, but I'm on a very tight timeframe. After the WiMicros didn't come in, the project parameters basically shrunk to "anything that doesn't require purchasing and shipping a peripheral". I'll definitely check these out in the future, because they seem awesome, but right now I'm still looking for a quicker, probably dirtier solution. Thanks!!
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-09-19 19:00
    OK... StampPlot ships with TCP to Serial gateway software to allow it to connect to act as a tcp-serial passthough, and it's free, though there's iffy password that sometimes works.. I think it's "selmasoft", you could run it with a PC (windows) on one end with a serial connection to a Stamp, then from your other end make a TCP connection to it.

    Good luck finding something else if this doesn't help! I'm out of ideas [noparse]:)[/noparse]

    http://www.stampplot.com

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-09-19 19:01
    Oh, there's plenty of other virtual TCP com port programs out there too....
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    Personal Links with plenty of BASIC Stamp info
    StampPlot - Graphical Data Acquisition and Control
    AppBee - XBee ZigBee / IEEE 802.15.4 Adapters & Devices
  • MaxMax Posts: 13
    edited 2006-09-19 23:01
    Thanks Martin... I Googled "Virtual TCP port" and I've found a veritable gold mine... it's too bad most of this is Windows only, because I personally use Linux and my professor is phobic of anything that isn't Mac. They all seem to cost money, too... woe is me, the moneyless electronics enthusiast, the collegiate perpetrator of jury-rigged and networked mutant microcontroller follies!
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-09-20 01:03
    If you have any programming experience, you should be able to put something together with something like Perl, Python, C, etc., which you could run on Linux or Mac.
  • MaxMax Posts: 13
    edited 2006-09-20 02:17
    Kevin, good idea... I do have some programming experience, but it's really tough to get to "hello world" when working with new protocols in languages like C, and trying to get RS-232 AND TCP/IP working at the same time sounds like a total nightmare. I'll try it later in the term, maybe, when I have some more time.

    At the moment I'm using Max/MSP. It's a visual programming language put out by Cycling '74. It took about 10 minutes to connect two computers... unfortunately, it's $500 and the only reason I got to use it is because my college has a license for its computer center boxes!
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-09-20 21:30
    I don't think it would require all of that. If you use some language that is CGI capable, and has some form of serial port access, you should be able to call a script that does the interfacing for you.

    So, if you have something like a Perl script monitoring the BS2 via a serial connection, you could just send a request to Perl, and have the script do it's thing.

    Here's an article that you might find useful: www.linuxjournal.com/article/7403
Sign In or Register to comment.