Society of Robots - Robot Forum

Software => Software => Topic started by: SciTech02 on November 02, 2008, 06:26:01 PM

Title: Can you establish two telnet connections in one script (so I can use two APIs)?
Post by: SciTech02 on November 02, 2008, 06:26:01 PM
This may be a stupid or overly obvious question, but here it goes:

Various programs have features I would like to use in my scripts.  These features can be accessed through built in API functions.  These API functions are made possible by establishing a telnet connection to that program. 

Alright, here's my question.  There are two programs that make use of API functions that I wish to use in a script at the same time.  To do this, I have to establish two different telnet connections in the same script.  Is this possible, or can I only establish one telnet connection at a time (or, in other words, only use one of these APIs at a time)?

Thanks in advance.
Title: Re: Can you establish two telnet connections in one script (so I can use two APIs)?
Post by: kevinisnekkid on November 04, 2008, 08:43:15 PM
Need more info... can you give an example of what you mean? But you probably can do it...
Title: Re: Can you establish two telnet connections in one script (so I can use two APIs)?
Post by: SciTech02 on November 05, 2008, 12:38:32 AM
Well, the host of this type of telnet connection is 'localhost' (the same computer with the programs I want to connect to).  The address of program A is 9000 and the address of program B is 6060.  What I was asking is if you could establish two of these connections at the same time.  Here's a crude pseudo code of what I want to do:

//establish connections:
telnet(localhost - to - 9000)
telnet(localhost - to - 6060)
//Now you can send (API) commands across both these connections to each program, when specified.

Yes, this should be possible; actually seems obviously simple now...  ::)  I would have tried this out first before posting a question, but my robot is packed away temporally, so I can't do anything with it.

If this topic was spam, I apologise (still learning/getting used to/perfecting my programing skills).
Title: Re: Can you establish two telnet connections in one script (so I can use two APIs)?
Post by: jamort on November 08, 2008, 10:43:06 PM
you could make a command open new prompt then have telnet after the one on the one prompt and another connection on the other prompt
Title: Re: Can you establish two telnet connections in one script (so I can use two APIs)?
Post by: CrashOverron on November 09, 2008, 01:36:11 PM
yeah you can connect both at the same time you will get a socket id for each so set them as different variables and just use those