Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

socket problem chat?

Thread view: 
Marc Collin - 07 Dec 2005 04:17 GMT
hi

i would like to know how in a application client/server how we send received
message to all client?

thanks
Chris Smith - 07 Dec 2005 04:35 GMT
> i would like to know how in a application client/server how we send received
> message to all client?

In general, there are two ways.  One is to use multicast.  The other is
to individually send the message to each client.  Unless you're dealing
with a very large number of clients, it's probably best to do the
latter.  Just keep a list of clients, and write a list to send messages
to each one... perhaps each in a different thread to control the delay.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Marc Collin - 07 Dec 2005 15:59 GMT
>> i would like to know how in a application client/server how we send
>> received message to all client?
[quoted text clipped - 4 lines]
> latter.  Just keep a list of clients, and write a list to send messages
> to each one... perhaps each in a different thread to control the delay.

ok for the second method but we need to connect to the client
the client need to be a server..
Roedy Green - 07 Dec 2005 20:07 GMT
On Wed, 07 Dec 2005 10:59:13 -0500, Marc Collin
<collinm@laboiteaprog.com> wrote, quoted or indirectly quoted someone
who said :

>ok for the second method but we need to connect to the client
>the client need to be a server..

Or:
1. UDP
2. every client maintains a socket
3. clients check in with HTTP every "minute" or so to see if there is
a massage.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Chris Smith - 07 Dec 2005 20:21 GMT
> ok for the second method but we need to connect to the client
> the client need to be a server..

When you establish a TCP connection from a client to the server, that
connection is two-way.  The server can use it to send data to the
client.  That's why java.net.Socket has methods called getInputStream()
and getOutputStream().

If your client disconnect, though, then yes they will need a
ServerSocket to listen for reconnection attempts from the server (and
this is also problematic because many -- or most? -- clients won't have
publicly available ports.)

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

zero - 07 Dec 2005 20:48 GMT
Chris Smith <cdsmith@twu.net> wrote in news:MPG.1e00f21c1bd135c4989c00
@news.altopia.net:

>> ok for the second method but we need to connect to the client
>> the client need to be a server..
[quoted text clipped - 8 lines]
> this is also problematic because many -- or most? -- clients won't have
> publicly available ports.)

Typically it's the client that connects to the server.  The server just
sits, waiting for clients to connect.  If you need the server to connect to
the client (instead of the other way around) you may want to rethink your
design.

Signature

Beware the False Authority Syndrome

Roedy Green - 07 Dec 2005 09:11 GMT
On Tue, 06 Dec 2005 23:17:06 -0500, Marc Collin
<collinm@laboiteaprog.com> wrote, quoted or indirectly quoted someone
who said :

>i would like to know how in a application client/server how we send received
>message to all client?

Consider using UDP. You can even then have clients send direct to each
other.

see http://mindprod.com/jgloss/udp.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.