Re: Bad ServerSocket ! Listen! Listen! Listen!

From: kjc (ksitron_at_elp.rr.com)
Date: 08/01/04


Date: Sun, 01 Aug 2004 17:01:30 GMT


#1, the ServerSocket doesn't start a new thread, you do.
#2, The code is blocking because a) you don't have the thread properly
coded, and b) in your thread, your're waiting for I/O

Donny wrote:
> ok .. just wanted some help .. ( throw new YeahWeKnowException() !!)
>
> after extensive 're-search' , i've found out that a ServerSocket is
> supposed to go back to listening after starting a new Thread to handle
> the returned Socket...
>
> here's the problem-code:
>
> ServerSocket serv_sock = new ServerSocket(80);
> while(true) {
> Socket temp = serv_sock.accept();
> new ServiceManager(temp).start(); //code is blocking here!!
> }
>
>
> ServiceManager is a class that extends Thread.
> what is happening is that code blocks at the area shown... the while
> loop is not continued, until the socket that is passed to the
> ServiceManager is closed...
> the serv_sock doesn't go back to listening...
>
> ... could anyone please throw some light on the matter..??
>
> thanks in advance....



Relevant Pages

  • Re: How to do Async TCP Listener?
    ... I suspect your listening socket is a "blocking" socket ... If so, your client ...
    (microsoft.public.dotnet.languages.vb)
  • Bad ServerSocket ! Listen! Listen! Listen!
    ... the returned Socket... ... ServerSocket serv_sock = new ServerSocket; ... ServiceManager is a class that extends Thread. ... the serv_sock doesn't go back to listening... ...
    (comp.lang.java.programmer)
  • Re: Bad ServerSocket ! Listen! Listen! Listen!
    ... > the returned Socket... ... > ServiceManager is a class that extends Thread. ... > what is happening is that code blocks at the area shown... ... > the serv_sock doesn't go back to listening... ...
    (comp.lang.java.programmer)
  • Re: My server sometimes goes deaf to certain hosts
    ... If your program is blocked on a pipe or unix socket, ... new TCP connections because it won't call 'accept' until the blocking ... so you are saying that the listening process might be blocking ...
    (comp.os.linux.development.apps)
  • Re: !EventConnect Problem
    ... the June roll-up is available somewhere, although there's not been the usual ... The socket is not in a listening state. ... The incoming connection queue has no room for connections. ...
    (microsoft.public.windowsce.app.development)