TCP stream though proxy (chaining) functions

Community Forums/Showcase/TCP stream though proxy (chaining) functions

Andres(Posted 2007) [#1]
Open TCP streams through proxy servers. Chaining supported.

It's recommended to ping proxies so it can connect to fastest one(s)

OpenProxyConnection(server$[, port%][, depth%])
Default port% is 80 and depth% is 1
depth% is the count of proxies in chain to use to reach the destination server

After successfull connection use Blitz's own TCP stream functions.

Example:
Include "multiprox.bb"

; Insert some proxies to system
AddProxy("69.88.144.162")
AddProxy("66.98.238.8", 3128)
AddProxy("65.83.25.189")
AddProxy("69.88.144.163")

; Ping proxies (first, parameter is for bandwidth testing, default is True, second is for sorting by ping (default True))
PingProxies(False, True)

; Open proxy connection
stream% = OpenProxyConnection("www.google.com", 80, 2)

WriteLine stream%, "GET / HTTP/1.1"
WriteLine stream%, "Host: www.google.com"
WriteLine stream%, "User-Agent: MultiProx"
WriteLine stream%, "Connection: Close"
WriteLine stream%, ""

Repeat
	If ReadAvail(stream%) then Print ReadLine$(stream%)
Forever
WaitKey


Functions (multiprox.bb):



jfk EO-11110(Posted 2007) [#2]
Pretty useful stuff, thanks.


Andres(Posted 2007) [#3]
I've ran into a problem with proxy connection. It connects fine to HTTP server but FTP servers doesn't seem to be compatible. Are there some limitations for that?


jfk EO-11110(Posted 2007) [#4]
I have no idea. Maybe one for the forums coding section.