Interoperating UDP and TCP binding questions
-
Tuesday, March 13, 2012 1:44 AM
Hi all,
I know I might be in the wrong forum to ask this question but I have no luck in getting an answer from asp.net (for asking udp binding in .NET 4.5), so I like to try my luck over here.
Basically, I have 2 services: a TCP service and within that, it has a UDP service to send multicast messages as well as to receive multicast messages.
The TCP service is used to provide clients with the usual service interface. However, some of the "operation contract" of the TCP service will perform multicasting of messages to all connected UDP clients (sometimes including itself).
for example:
client side -
TcpServiceClient proxy = new TcpServiceClient(); proxy.MulticastString("This is a UDP message"); proxy.Close();Service side -
Public void MulticastString(string udpMsg) { //Do some other stuff ... udpProxy.SendMessage(udpMsg); }
How to create and use both the TCP Service and the UDP service?
If possible please provide a full example to works out this problem which include sending and receiving of upd messages.
Thanks.
- Edited by eva2002 Tuesday, March 13, 2012 1:45 AM
All Replies
-
Tuesday, March 13, 2012 2:18 AM
You'll have to look at the netPeerTcpBinding for Peer To Peer communication. I think this is the only binding where WCF can send unsolicated messages to clients.
I haven't read the article myself but it does come with examples
http://msdn.microsoft.com/en-us/library/cc297274.aspx
Also, Yi-Lun Luo pointed this UDP Example out in a different Thread
http://msdn.microsoft.com/en-us/library/ms751494.aspx
I've also attached a link to the above mentioned thread if you interested
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8afea9ed-584b-4b56-ace5-a1515a2f7067
- Edited by Dragan Radovac Tuesday, March 13, 2012 2:41 AM
-
Tuesday, March 13, 2012 3:05 AM
Thanks for your quick reply.
Actually, there is no need to create UDP transport layer/binding.
.NET 4.5 includes UDP binding as out-of-the-box solution. The only problem is how to use it.
With UDP alone, I am able to make use of it. However, when I create the UDP service within a TCP service, I was unable to publish the metabase wsdl link. Thus I wasn't able to port the service reference into my client project.
I am currently reading about udpclient. Hope it will help me to solve my problem.
UDP service - http://msdn.microsoft.com/en-us/library/tst0kwb1(v=vs.110).aspx
- Edited by eva2002 Tuesday, March 13, 2012 3:06 AM
-
Tuesday, March 13, 2012 3:09 AM
In the article mentioned earlier:
http://msdn.microsoft.com/en-us/library/ms751494.aspx
It shows how to add your udp service into wsdl metadata that can be read by svcutil
- Marked As Answer by Yi-Lun LuoModerator Monday, March 19, 2012 12:16 PM
-
Friday, February 08, 2013 9:26 PM
How did you end up solving your issue? I need to do something similar.
I currently have TCP client, server communicaitons, and I need to add multicast from server to all its client.

