473,486 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

udp multicast server and client

I have a two systems and I am able to communicate both systems using
udp server and client at both ends but I need to make one system as
concurrent server and now I would like to add one more system into the
group and now I would like to multicast the message from My main
server to the new joined system and now I should be able to send and
recieve from both the other systems to the main server.
Exactly what I have with me is : Two systems having udp server and
client programs running in each of the systems and they are
communicating well.
Now what I need is I am adding one more system to my network and I
should be able to serve the other system also from One of this
systems.For this I have made One thread as listener thread and every
time a new client comes for service it is seperated as new thread. But
I facing the problem here recvfrom() got blocked. I need any one of ur
help. Please Note that I am using only UDP sock streams not TCP.Thanks
for helping me.
Jun 27 '08 #1
4 5981
sk****@gmail.com said:
I have a two systems and I am able to communicate both systems using
udp server and client at both ends
If you have a client-server networking architecture, you'd almost certainly
be better off with TCP.

<snip>
Now what I need is I am adding one more system to my network and I
should be able to serve the other system also from One of this
systems.For this I have made One thread as listener thread and every
time a new client comes for service it is seperated as new thread.
That is a very common design, but not one that I consider to be very wise.
When there are many clients, it over-uses thread resources, and under-uses
everything else. Having said that, it sounds like you only want to have a
very, very tiny network, so perhaps in your case it doesn't matter.
But
I facing the problem here recvfrom() got blocked.
Look long and hard at select(), which is not a standard C function. You are
more likely to find network programming expertise somewhere like
comp.unix.programmer - so I recommend you try that group for future
questions (or even for this one, if select() doesn't sort you out).
I need any one of ur
help. Please Note that I am using only UDP sock streams not TCP.
That's impossible. UDP doesn't do streams. It's a datagram protocol. Fire
and forget.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #2
sk****@gmail.com wrote:
Now what I need is I am adding one more system to my network and I
should be able to serve the other system also from One of this
systems.For this I have made One thread as listener thread and every
time a new client comes for service it is seperated as new thread. But
I facing the problem here recvfrom() got blocked. I need any one of ur
help. Please Note that I am using only UDP sock streams not TCP.Thanks
for helping me.
You probably should ask on comp.unix.programmer (or a winsock
equivalent). As Richard just said, your situation is not uncommon,
similar question often pop up on c.u.p.

As an aside, using blocking sockets with threads is common. Also you
can't reliably stream over UDP without a using higher level protocol to
do the work usually done by TCP.

--
Ian Collins.
Jun 27 '08 #3
On 25 Apr 2008 at 4:30, Richard Heathfield wrote:
sk****@gmail.com said:
>But I facing the problem here recvfrom() got blocked.

Look long and hard at select().
Good advice. Perhaps a short piece of example code will be helpful to
the OP.
#include <sys/select.h>

....

/* set up your socket with file descriptor fd */

....

int r;
fd_set rfds;
struct timeval tv;

FD_ZERO(&rfds);
FD_SET(fd, &rfds);

tv.tv_sec = 30;
tv.tv_usec = 0; /* timeout after 30 secs plus 0 ms */

r=select(fd+1, &rfds, NULL, NULL, &tv);

if (r<0) {
/* deal with error */
} else if (r==0) {
/* deal with timeout */
} else {
recvfrom(fd, ...);
...
}

Jun 27 '08 #4
On Apr 25, 9:30 am, Richard Heathfield <r...@see.sig.invalidwrote:
skp...@gmail.com said:
I have a two systems and I am able to communicate both systems using
udp server and client at both ends

If you have a client-server networking architecture, you'd almost certainly
be better off with TCP.

<snip>
Now what I need is I am adding one more system to my network and I
should be able to serve the other system also from One of this
systems.For this I have made One thread as listener thread and every
time a new client comes for service it is seperated as new thread.

That is a very common design, but not one that I consider to be very wise.
When there are many clients, it over-uses thread resources, and under-uses
everything else. Having said that, it sounds like you only want to have a
very, very tiny network, so perhaps in your case it doesn't matter.
But
I facing the problem here recvfrom() got blocked.

Look long and hard at select(), which is not a standard C function.
http://beej.us/guide/bgnet/output/ht...et.html#select
hope this is helpful.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2629
by: ian maclure | last post by:
I'm writing a client-server app. Client controls Server which in turn configures and controls a bunch of hardware. I want to be able to start the server from my client. Now in C/C++ one could...
0
1390
by: Hüseyin DEMİRAĞ | last post by:
Hi all, I think that I should ask the question like that. I want to run MySQL on 14 client. What am I do. I try but There is a problem that i can't find... Please help me. Hüseyin DEMİRAĞ...
3
2476
by: MBW | last post by:
The following code is for a simple server/client asplication that allows the user to toggle between serve and or client modes and send/recieve a message however i am getting an Attribute error on...
2
1712
by: Prabhat | last post by:
Hi All, How can we fine if the SQL Server Client is Installed in the System or Not. (Using VB and/or Delphi) As My EXE Require SQL Server Client to Work so I have to Check that If the Client...
0
1168
by: mandrivacsprof2030 | last post by:
Hi there. I have a problem in socket programming. I'm writing a server/client application in C#. When client connects to the server, a text-based communication between server and client. When...
0
1505
by: 85ssp | last post by:
I am creating a small server client program that is meant for up to 70 connections from 70 different computers on a network. Everything in the program functions correctly except when testing...
1
2187
by: vijayakumar | last post by:
hi all I'm beginner in CORBA Server-Client application development. My server- client application was worked well and i have tested it too. Due to some Network problem we have rebooted our...
3
7165
by: Hukkky | last post by:
I'm testing simple server/client codes on linux. just server can wait for client's connect sign and accept, and client can't connect to server, this is all. There's no problems just for this...
2
5395
by: fredszky | last post by:
Hello I am very new to perl, however i managed to make this server/client work with udp, now i would like to do the same thing but with TCP/IP, what must i do? Server: #!perl -w # Server...
3
4503
by: supriya prasad | last post by:
I am trying to set up a server client network .Server will be able to stream live audio captured from a radio receiver connected to its line in port to multiple clients over the network. ...
0
7100
marktang
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,...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
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...
1
6842
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...
0
7330
tracyyun
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...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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 ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.