program output that doesn't wait for replies but still captures them

I am trying to write a program that can communicate over a very latent internet connection involving a cellular modem. I have some software packages that handle all the telnet like business and will pipe stdout and stdin to a program I can have it execute.

The problem I am running into is that I have to send about 900 ASCII commands to an instrument to request data but it takes about a second between when a command goes out and when a reply comes back. This will wind up taking a very long time and I am looking to speed it up. All of the commands are independent of the reply so what I need to do is create a program that can send all 900 commands with maybe 10ms break between them and to not wait for a reply. It then needs to read the replies and write them straight to a file.

It seems like this should be achievable in C++ but I only have a very basic understanding of the language and thus am not sure where to start.

I am open to using other languages but thought C++ would be a reasonably good start so I can distribute the program to my coworkers. All of our work machines are Windows but if there is a simpler solution from Linux, I should be able to work something out. I'm just trying to avoid complication.

Any suggestions as to where to start??
Okay, so I'm thinking if i alternate between sending a command and a while (!eof) {} loop with getline so it will just read everything in the stream between each command. Does that seem about right? I'm not entirely sure I understand how the EOF bit works. Any guidance out there?
You're looking at doing two tasks, in this case send and receive, parallel to and independently of each other. This means multithreading which is more of an intermediate subject. It's made easier by libraries like SFML and BOOST, but you should have experience with how those "flow" before tackling something like this. It isn't terribly difficult, but it's the kind of thing that can discourage beginners.

Your second idea is a perfect example of what is called "spaghetti code", just because some piece of code accomplishes a task doesn't mean that it is the correct code to use in that situation.
Ok, I'm all for learning how to do it 'right'. I have one problem and that is that I need a functional solution more immediately. I'll write a band-aid fix with some spaghetti code as you say and dive in to multithreading for a permanent solution. Can you point me to some place I can begin my research?
Since MT is usually platform dependent and you indicated that you would like a cross-platform solution, I would recommend a library. SFML is pretty easy to use and setup: http://www.sfml-dev.org/. The tutorial doesn't cover multithreading but it will give you a feel for how the library is used. If after that you have any more specific questions about implementation a lot of people here, including myself, have experience with this lib.
Brilliant. I'll start there. Thanks!
Topic archived. No new replies allowed.