Re: a problem with Socket
From: NetShiva (netshiva27_at_yahoo.com)
Date: 08/20/04
- Next message: Jonck van der Kogel: "Re: odds and evens numbers"
- Previous message: Wes Harrison: "Re: Where do I start with this threading issue?"
- In reply to: alessandro: "Re: a problem with Socket"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Aug 2004 03:45:20 -0700
Looks like you are looking to build an tcp server in java.. check this
out www.quickserver.org i use it and it rocks..
"alessandro" <halex2000@virgilio.it> wrote in message news:<5O3Tc.104772$OR2.5466361@news3.tin.it>...
> Ok, now the problem with the connection is solved: when the server was
> listening and I closed the connection, I didn't call ServerSocket.close(),
> so the next time the system wouln't let me create the same ServerSocket.
>
> > Use a java.nio.Selector to handle multiple connections from a single
> > thread.
>
> I don't know what JVM version is installed on the target machine. It could
> be not the 1.4. Other than that, is not this the very problem.
>
> > On the other hand, if there will only be a single connection, there is
> > no reason to not let your process block while waiting for input from
> > the peer.
>
> There is a GUI. The user should be able to interact with it.
>
> >If you use ready() or available() in a loop that just reads
> > from a single Reader or InputStream, you are simply wasting CPU in
> > order to avoid an imagined problem.
>
> This would not be a problem. The read() method would be called from a timer
> 10 times per second or so.
>
> The problem is that (following the documentation), available() always
> returns 0 on some systems, and should not be used in these manners. Then I
> tried ready(), but returns false. I would like not to use a separate thread
> for the network class, since that would mean adding a lot of extra code.
> This app will be used just one time (university project) from my
> professor...
> Thank you for the help.
>
> Alessandro
- Next message: Jonck van der Kogel: "Re: odds and evens numbers"
- Previous message: Wes Harrison: "Re: Where do I start with this threading issue?"
- In reply to: alessandro: "Re: a problem with Socket"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|