|
Home > Archive > Unix Programming > June 2006 > UDP Request For Help
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
UDP Request For Help
|
|
| alijsyed 2006-06-09, 7:24 am |
| Hi:
I would like to ask all of you if there is any reference code relating
to the following:
1) I need a server to broadcast a general multicast packet to all
listening CLients
2) CLients repsond back and both switch to TCP
This sounds trivial but trust me I can't find much on this.
I find a lot of stuff on UDP clients initializing the conversation but
not the server.
Any help would be appreciated. (I am trying to do this in C not C++).
(I am using Linux as well)
Thanks
Ali
| |
| Pascal Bourguignon 2006-06-09, 7:24 am |
| "alijsyed" <alijsyed@hotmail.com> writes:
> Hi:
>
> I would like to ask all of you if there is any reference code relating
> to the following:
>
> 1) I need a server to broadcast a general multicast packet to all
> listening CLients
> 2) CLients repsond back and both switch to TCP
>
> This sounds trivial but trust me I can't find much on this.
> I find a lot of stuff on UDP clients initializing the conversation but
> not the server.
>
> Any help would be appreciated. (I am trying to do this in C not C++).
> (I am using Linux as well)
There's no difference.
There's no notion of client or server in UDP or TCP.
Just peer hosts sending and receiving UDP packets, or listenning for
incoming TCP connections and connecting to TCP ports.
So what you have is:
1) a host that broadcasts a general multicast packet to other hosts
listening for it,
2) a host that responds to a UDP packet.
3) a host that connect to a remote TCP port.
4) a host that listen to a TCP port.
I guess in all the examples you have at hand, you'll be able to find
how to do each of these operations.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay
| |
| Renato 2006-06-09, 1:24 pm |
| alijsyed wrote:
> 1) I need a server to broadcast a general multicast packet to all
> listening CLients
> 2) CLients repsond back and both switch to TCP
googling for "udp server c" I just found:
http://pont.net/socket/
i'm sure you can find much more...
By switching to TCP, you don't need to switch it on the same session
(UDP has no "session"), but you can just trigger a TCP client to connect
to the TCP server on the same machine.
--renato
| |
| Dave Littell 2006-06-11, 1:27 pm |
| alijsyed wrote:
> Hi:
>
> I would like to ask all of you if there is any reference code relating
> to the following:
>
> 1) I need a server to broadcast a general multicast packet to all
> listening CLients
> 2) CLients repsond back and both switch to TCP
>
> This sounds trivial but trust me I can't find much on this.
> I find a lot of stuff on UDP clients initializing the conversation but
> not the server.
>
> Any help would be appreciated. (I am trying to do this in C not C++).
> (I am using Linux as well)
>
Definitely buy a copy of UNIX Network programming (Stevens, et al).
Are all the clients on the same subnet as the server? If you use a
subnet broadcast to a specific UDP port (to which the clients have
already bound) you can then have the clients bring up their TCP
connection(s) to the server.
Or, you might want to use only TCP and use a superserver architecture.
Good luck,
Dave
|
|
|
|
|