Article View: borland.public.jbuilder.java.api
Article #1793Re: Quick question about sockets.
From: Joi Ellis [TeamB]
Date: Fri, 07 Sep 2001 13:32
Date: Fri, 07 Sep 2001 13:32
23 lines
1826 bytes
1826 bytes
Alex Colic <alex.colic@pop-ware.com> wrote: > Hi, > Ok I am obviously doing something wrong. I picked the ServerSocket class > because I do not know what host is going to send me commands, just the port. > Any idea how I can have more than one class just listen to the same port for > commands? You can't. The general idea for this is to have a class that does nothing but listen, then spawns threads to handle incoming connections. Once the child threads have their sockets, the parent goes back to listening for more connections. This is pretty much how inetd works on *nix. There are examples of doing this in Java in the O'Reilly 'Java Networking' book, among others. -- Joi Ellis (TeamB) http://www.teamb.com/ No direct email, please. For best results, post on news server newsgroups.borland.com! Newsgroup Guidelines: http://www.borland.com/newsgroups/guide.html Only posts which violate the rules in guide.html are subject to cancelation.
Technical Details
Message-ID:
<3b98cc80_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mailReferences:
<3b97d61e_1@dnews> <3b9859d6$1_2@dnews> <3b98be46$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,75eb349919d2da57
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-09-07 06:35:31 PST
Message-ID: <3b98cc80_1@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: Quick question about sockets.
Newsgroups: borland.public.jbuilder.java.api
References: <3b97d61e_1@dnews> <3b9859d6$1_2@dnews> <3b98be46$1_2@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 7 Sep 2001 06:32:48 -0700
X-Trace: dnews 999869568 209.46.41.66 (7 Sep 2001 06:32:48 -0700)
Lines: 23
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail