1

A pretty simple question, but failed to find any proper answer for it;

Is it possible to set a specific port to use when doing a (GET) http request with Volley as library?

Stefan de Bruijn
  • 6,289
  • 2
  • 23
  • 31

2 Answers2

5

Seems adding ":{portnumber}" to the url works just fine too.

Stefan de Bruijn
  • 6,289
  • 2
  • 23
  • 31
1

Yes. But some source code editing is required.

Volley's RequestQueue uses either an HttpClientStack for Android version 8, or a HurlStack for 9 and up, to perform the actual request. In both of these classes, the string you provide as a URL when you create a request is turned into a URL or URI object. You can edit their constructors to set the port you want.

Itai Hanski
  • 8,540
  • 5
  • 45
  • 65