This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes socket question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

socket question

Steven Alvarez
Ranch Hand

Joined: Nov 01, 2006
Posts: 66
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?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: socket question
 
Similar Threads
Error in JSP
SMTP server does not deliver mail to user's mailbox
find multiple occurences of string in file
SMTP not working perfectly
jsp:setProperty question