View Full Version : Big challange (two scripts "talking")

08-14-2002, 06:34 PM
I'm trying something really difficult (I guess).

What I want to do:
I'm creating two scripts; reciever.cgi and caller.cgi the reciever.cgi will be running on my server, lets say on port 1234.
Now, when I run caller.cgi I want this one to connect to reciever.cgi, tell the local version, ask what the newest version is and close the connection.

What I got:
Reciever.cgi is working pretty well, if I connect to it using SecureCRT (http://www.vandyke.com/download/securecrt/index.html) (a Telnet and others program) it all works fine:
(* (red)=reciever.cgi and - (green)=Me (SecureCRT (http://www.vandyke.com/download/securecrt/index.html))
* Hello
- version:
* you are running version
- version?
* version=2.0
- quit
* Bye

and the output in the Commandprompt (WinXP) in wich reciever.cgi is running tells me this:
listening at port 1234 connected
Current user(s) online: 1
version 1,234 ( found on disconnected
Current user(s) online: 0

The problem:
Everything seems to work fine, but caller.cgi hasn't been used ;)
As soon as this script comes into play it all goes wrong:
Output of caller.cgi:
you are running version

Output of reciever.cgi using caller.cgi: connected
Current user(s) online: 1
version 1,234
qui <
qui> found on

It looks like reciever.cgi doesn't know when caller.cgi ends a line (where it does using SecureCRT (http://www.vandyke.com/download/securecrt/index.html))

Is there anyone who can fix this problem and make these scripts work? Or at least give me a hint?

I hope I didn't frighten you with all this text.

Thank you so much!
Mzzl, Chris

P.S. I got a zip-file attached (talking.zip) with the two files

08-15-2002, 03:06 AM
This is not an easy one to work on considering the circumstances...

Personally, I think you've got latency issues between your calling and receiver script... that is, your calling script is blabbing out all of those commands before the receiver script can even get a word out edgewise.

This should always work on paper, but you're dealing with io ports and backside server resources that must be configured by the program when it gets triggered. Consider that also... your calling script is working 3 times faster than the receiver... (check your script length), and it might make some sense.

I ran these between two separate servers and came up with the same problem, but I did have different results from you.... which means that it is a time delay that you've got to work around.

There's a lot of info out there on the IO mods, but I've never found anything other than "my father the sw engineer wrote this at harvard", and virtually nothing that actually makes any sense - to the normal set of us fools to properly use all of the parameters of these things. Maybe somebody else has dealt with this and can help.

Just my 2 cents.

PS: I'm working with the same kind of thing myself, but I'm doing openssl/ssleay (successfully though...) and this is NOT a very kind hearted area to work in for the gp programmer; You almost need to become a specialist in it, keep good notes, and never lose them because there will always be a need for it in the future.

That said, don't you hate all of the web references that show up on the search engines that seem to have everything you need in the description... and yet, the web freakin page is disappeared or dead cause some .edu/~student/watchme/~myperfectscript-to-solve-your-exact-problem.html guy left campus and went to work for microsoft?


08-15-2002, 11:35 AM
Though your reply didn't solve my problem I want to thank you for replaying and taking time to look at my script.

This doesn't mean I don't want this problem solved, so if there's anyone who can give me more information on this...

Mzzl, Chris

08-17-2002, 05:37 AM
I have an idea ...

you can make an image that goes on the persons page which is located on your server

then when they enter an administration script or something ... it gets that image (eg: if the person is using version 1.4.5 then the script gets that image and returns it on the clients page.

eg: <img src=http://myhost.com/v1.4.5.gif>

then when a new version comes out ... you can change the text on that image to say "this version is now old" and the current version can say "this is the latest version ... no reason to update"

08-17-2002, 12:39 PM
That is really great and solves a part of the problem.

But this isn't the only reason I want these scripts to talk.
I know it's possible I've seen it on http://www.slyfx.com @ level 8 b
@ SlyFX the have challenges for the visitors, one of them was this:
Time for something a bit different now. You will need to setup a server on your computer on port 7654 for this (here was a link, but I can't give it to you because of the rules of SlyFX) script to connect to.
Pass the script the IP to connect to using a GET request for example sock.pl?ip=
The script has a simple protocol, just follow it as described below:

Script handshake:
[script sends] Hello
[script sends] END
[ you reply ] Hello Back
[ you reply ] END
[script sends] [100 random numbers]
[script sends] END
[ you reply ] [you reply with "lowestnumber:highestnumber" (without the quotes)]
[ you reply ] END
If the result is correct, the script will reply with the solution.
On that one I passed, but I only had to do one part (the reciever.cgi wich accepts the call) their script connected to mine

So if anyone knows how to do this, I'm very interested

Mzzl, Chris