Real Software Forums

Get rest of URL?
Page 1 of 1

Author:  MarkHolbrook [ Tue Aug 14, 2012 12:43 pm ]
Post subject:  Get rest of URL?

I'm sure there is a way and I spent about 30 minutes searching but I cannot seem to find what I remember reading before.

I have a small app that starts listening with a standard TCPSocket on port 7777.

From a browser I can connect to: and all is happy. The connection is made and the little app sends back a web page.

I seem to remember there is a way in RB, either using a different socket type or a call to accept something like: or

What I want to do is in my "Connected' method detect that "test" has been passed on the URL and act upon it.

I apologize but I've been buried in PHP for the last month so I'm struggling to get my mind back around RB and how to do this. Do I need to use a different socket type?

Basically I'm making a small webserver that does specific things. IE connecting to: Will paint a status display Might turn output #4 on (a fan or something)

So I need to grab the remaining part of the URL and parse it. I'd appreciate a pointer in the right direction.

Thanks in advance.


Author:  pony [ Tue Aug 14, 2012 12:57 pm ]
Post subject:  Re: Get rest of URL?

This is in the web server demo.

In a TCPSocket listen for the DataAvailable event, read it all in to a string called 'theHeaders' for example. Then parse out the Header:

temp = nthField( theHeaders, chr(13), 1 )
cmd = nthField( temp, " ", 1 )
param = nthField( temp, " ", 2 )

in your example you are looking for cmd to equal "GET" and param to equal "on4"

I have a Real Studio based web server that opens two electric gates, controls a PTZ camera, activates a dog shock collar, and streams 9 IP based cameras. It is all based on the idea you describe

Author:  MarkHolbrook [ Tue Aug 14, 2012 1:02 pm ]
Post subject:  Re: Get rest of URL?

Aw crap... The one method I didn't try... Ya I now remember reading that. Thank you so much.

I will tell you... PHP is fun but now I'm typing in semi colons behind every line in RB.

Have a great one!

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group