If this is the wrong group for this posting please let me know and I'll
move it.
I have an application that has an ArrayList of sockets to clients. For
standard one-to-one messages my application works great, the problem is
if I want to "broadcast" a message to all my clients. Right now I just
iterate through my sockets list and send the message to each client.
This works fine until I need to send something large like a file. Is
there a way that I can either send a byte stream to multiple sockets at
the same time, or have a socket that each client has a connection to?
If there is such a structure, does it actually broadcast, or does it
iterate through the clients and just make it look like it's
broadcasting. When I used to do MPI programming broadcasting was
faster, but only a little bit faster than iterating through, so I'm not
sure if .NET would be the same.
Anyways, thanks in advance, and if there's a better group for this
question please let me know. 5 2088
Justin,
If you are using a TCP/IP socket (as opposed to a UDP socket), then yes,
you will have to iterate through all of your clients.
I believe that if you use a UDP socket, then you can broadcast your
message, and you only have to do it to the one connection, since that is all
you will ever have (since it will be a broadcast socket).
However, using UDP might not be a good idea for you, since it isn't
guaranteed (like TCP/IP) to send the packets. Packets can be dropped, and
when using UDP, that's ok. It's up to you to handle these situations
gracefully.
You might want to just use different threads to write the details to
different sockets. It would prevent you from having to write the files to
each socket in a serial manner.
Hope this helps.
i
"Justin Creasy" <ju***********@ gmail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. . If this is the wrong group for this posting please let me know and I'll move it.
I have an application that has an ArrayList of sockets to clients. For standard one-to-one messages my application works great, the problem is if I want to "broadcast" a message to all my clients. Right now I just iterate through my sockets list and send the message to each client. This works fine until I need to send something large like a file. Is there a way that I can either send a byte stream to multiple sockets at the same time, or have a socket that each client has a connection to?
If there is such a structure, does it actually broadcast, or does it iterate through the clients and just make it look like it's broadcasting. When I used to do MPI programming broadcasting was faster, but only a little bit faster than iterating through, so I'm not sure if .NET would be the same.
Anyways, thanks in advance, and if there's a better group for this question please let me know.
Nicholas Paldino [.NET/C# MVP] wrote: You might want to just use different threads to write the details to different sockets. It would prevent you from having to write the files to each socket in a serial manner.
He could also take a look at multicasting, and talk with his network
administrator about it. It was designed for just such a situation.
Thx for the idea.
Dan
"jeremiah johnson" <na*******@gmai l.com> wrote in message
news:uA******** ******@TK2MSFTN GP12.phx.gbl... Nicholas Paldino [.NET/C# MVP] wrote: You might want to just use different threads to write the details to different sockets. It would prevent you from having to write the files
to each socket in a serial manner.
He could also take a look at multicasting, and talk with his network administrator about it. It was designed for just such a situation.
I don't know much about multicasting, but I can look into it. I am
using TCP for the connections. What would I have to work out with my
network administrator to allow me to use multicasting? This is
something that will potentially be used at multiple sites (schools in
particular) and if something has to be set up specifically in the
network, then that route probably won't work for me. So I will research
multicasting, but any information you have on it would be greatly
appreciated. The thread solution I've messed around with, but that
won't speed up the process of broadcasting any, it will just mean that
I'm slowly writing to 20+ sockets at the same time, vs quickly writing
to one socket at a time.
Multicasting is definitely what you want, then.
Multicasting is set up at the routers, yes, but it works beautifully.
I'm not sure on the *exact* specifics but the gist of it is that you
stream one copy of your streaming file (music, movie, whatever can
stream) to a specific IP address at your nearest router, and it will
stream one copy of that to the upstream router, which will stream one
copy of the stream to its upstream router, until eventually two
seperate streams are needed. the idea is that eventually your stream
will use the least amount of bandwidth possible (the same as one
stream) then split it out at the destination subnet to all the
computers that subscribe to that stream.
its been years since i've done networking so i could be wrong about the
details but it does exactly what you want. it just requires some
one-time configuration. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: pyguy2 |
last post by:
Issues of socket programming can be wierd, so I'm looking for some
comments.
In my python books I find exclusive use of socket.close(). From my
other readings, I know about a "partial close operation". So, I figured
it would be useful to post some code about how socket.close() has an
implicit send in it and you can actually gain some clarity by being
more explicit with the partial close which means splitting
socket.close() up into...
|
by: John Sheppard |
last post by:
Hi all,
I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose but have been unsuccessful in finding the answers so far. Either because my understanding of sockets isn't where it needs to be or my questions are too basic.
My programming environment is Windows XP, Visual Studio .NET 2003 and C#.
So here it...
|
by: John Sheppard |
last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand.
Programming environment. VS.NET 2003, C#, Windows XP.
About the architecture:
I have a socket server dll that contains a class that handles connections for a given local ipaddress and port. This class(server) can be started or stopped by calls to the appropriate functions. The server class has...
|
by: mscirri |
last post by:
The code below is what I am using to asynchronously get data from a
PocketPC device. The data comes in fine in blocks of 1024 bytes but
even when I send no data from the PocketPC constant blocks of 1024 with
all values set to Null arrive. Other than examine a block of 1024 to
see if the entire block is null, is there any other way to determine if
, say a chat message "Hi Charlie" has been received completely?
|
by: djc |
last post by:
I read a network programming book (based on framework 1.1) which indicated
that you should 'never' use the RecieveTimeout or the SendTimeout 'socket
options' on TCP sockets or you may loose data. I now see the
socket.RecieveTimeout 'property' in the visual studio 2005 help
documentation (framework 2.0) and it has example of it being used with TCP
socket. This propery is also listed as 'new in .net 2.0'.
1) is the socket.RecieveTimeout...
| |
by: Uma - Chellasoft |
last post by:
Hai,
I am new to VB.Net programming, directly doing socket programming. In C, I
will be able to map the message arrived in a socket directly to a structure.
Is this possible in VB.Net. Can anyone please help me with some sample
codings and guidance?
Can you also suggest some other news group available for socket programming
in VB.Net?
|
by: atlaste |
last post by:
Hi,
In an attempt to create a full-blown webcrawler I've found myself
writing a wrapper around the Socket class in an attempt to make it
completely async, supporting timeouts and some scheduling mechanisms.
I use a non-blocking approach for this, using the call to 'poll' to
support the async mechanism - rather than the 'begin' and 'end'
functions. I already found that connecting doesn't set the
"isconnected" variable correctly...
|
by: shonen |
last post by:
I'm currently attempting to connect to a shoutcast server
pull down the information from here and then I'll parse it.
I got this working with the httplib, which was great, the problem is I want to use the select statement to do only do this periodically. (I'm trying to be a client, accepting data, that might be my first problem)
Basically this is the code that im working on to TEST to mimic what the httplib does, only return a socket...
|
by: =?Utf-8?B?Sm9obg==?= |
last post by:
Hi all,
I am new to .net technologies.
ASP.NET supports socket programming like send/receive in c or c++?
I am developing web-site application in asp.net and code behind is Visual
C#. In page_load event, I am using atl com component. Here one for loop is
there. In this for loop, number of iterations are 1000, I can receive some
data using com component. It is just set of some characters like
|
by: Stuart |
last post by:
I am in the process of teaching myself socket programming. I am
"playing around" with
some simple echo server-client programs for m the book TCP/IP Sockets
in C.
The Server program is:
#include "TCPEchoServer.h" /* TCP echo server includes */
#include <pthread.h /* for POSIX threads */
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |