there are several ways to accomplish this, limited to your imagination. lets assume that the number of variables you want to send does not vary.
1. if they are binaries, you could pack it all into a string and send the string, then unpack it on the receiving side (see struct module) 2. you could just format the variables into a string, with some delimiter (like , or ;) in between the values. 3. you could use json (see the json module in python doc's, it really is straightforward). json.dumps creates the json string, jso.loads does the other side of the equation. just create the string, send it, and the other side does a loads, and you now have the variables back. 4. others could be done, but this is all I can readily think of on a Saturday morning. -- Extra Ham Operator: K7AZJ Registered Linux User: 275424 Raspberry Pi and Arduino developer *The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny...".*- Isaac. Asimov *I* *f you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime. *- Anonymous *If writing good code requires very little comments, then writing really excellent code requires no comments at all!*- Ken Thompson On Sat, Dec 19, 2015 at 8:52 AM, William Hermans <[email protected]> wrote: > This is a programming 101 question that has nothing to do with the Beagle > hardware. You should create an account on stackoverflow.com, and pose > your question there. Assuming, someone has not already asked a similar > question, as they do not realy care for duplicate questions . . . > Basically, that means search their site before asking. > > On Fri, Dec 18, 2015 at 10:25 PM, <[email protected]> wrote: > >> I'm trying to build a wifi controlled rover with a BBB using python. >> My basic plan is to use a joystick on the client, store multiple joystick >> inputs to variables, then relay the variables via socket to the BBB. >> >> I initially thought this could easily be done by using socket until I >> realized that I can't find a way to differentiate the variables from one >> another. I've thought of sending a specific string before sending the >> actual joystick value so that I could just add something simple like "if >> recv=axis0 then recv=joystick variable", but this proved extremely slow and >> unreliable during joystick movement, especially if it was more than one >> axis being moved. >> I read that json could be used but I didn't quite understand it. >> >> What I need is a simple and efficient way to send multiple variables over >> an internet connection through python. It does not matter if all variables >> are sent at once as long as they can be differentiated. >> >> Any help is really appreciated. >> >> -- >> For more options, visit http://beagleboard.org/discuss >> --- >> You received this message because you are subscribed to the Google Groups >> "BeagleBoard" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > For more options, visit http://beagleboard.org/discuss > --- > You received this message because you are subscribed to the Google Groups > "BeagleBoard" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
