proxy on http

Hi there, i’ve got a little question here.

normally i used proxy like this:

Dim h as new HTTPSecureSocket h.HTTPProxyAddress = app.proxy_server h.HTTPProxyPort = app.proxy_port

But i dont want to set a new socket all time and i need some events so i use this object now:

How can i add the HTTPProxyAddress and HTTPProxyPort to the object so that every “http = new wHttps” get this two properties without i have to write it all time :slight_smile:

Make a method named Constructor and put it in there. That will fire when each one is created use Self instead of the variable name.

That was a really good hint, thank you :slight_smile:

… and of course to each Constructor there is always a Destructor :wink:

in the case you don’t need to extend HTTPSecureSocket class, you can add a method

Function NewSocket(server as String, Port as Integer) as HTTPSecureSocket
  dim h as new HTTPSecureSocket
  
  h.HTTPProxyAddress = server
  h.HTTPProxyPort = Port
  
  Return h
End Function

then call it everytime you want to create a new socket

dim h as HTTPSecureSocket = NewSocket(app.proxy_server, app.proxy_port)