File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 61218
    
  66

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: socket question