This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
    Bookmark Topic Watch Topic
  • New Topic

socket question  RSS feed

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Report post to moderator
Ok I found this on the net


I was wondering how can I change this from 1 socket to lets say 20. Do I just do a loop?
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Report post to moderator
Ah, this is clearer than the copy of the question over in the Sockets forum. The sherrifs will probably close this one, but I'll toss something in first.

You have a socket client that issues a GET to a web server somewhere and displays the results. I'd get this code out of main and into an instance method. Then we could do something like:

You could do that in a loop neatly enough. Once that's working for you, we can talk about threads and doing several at once.
 
Author and ninkuma
Marshal
Posts: 66684
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
Just the other day, I was thinking ... about this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!