Click here to Skip to main content
15,888,340 members

Comments by Member 10080434 (Top 2 by date)

Member 10080434 10-Jul-13 0:49am View    
Thanks for reply and given interest in my post. i am doing based on event and i am using callback concept of wcf. it is working.
but i am getting now one problem that is, i want to do communication on udp protocol in wcf.
and i don't know properly custom binding. i have also gone through UDP transport article given by microsoft --> http://msdn.microsoft.com/en-us/library/ms751494.aspx.

i did program for server like this.
i have added reference of udptransport dll.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using Microsoft.Samples.Udp;


namespace udponwcf
{
[ServiceContract]
public interface IUpdatePlayerInfoContract
{
[OperationContract(IsOneWay = true)]
void Update(byte playerID, byte locationX, byte locationY);
}


class playerInfoService : IUpdatePlayerInfoContract
{
public void Update(byte playerID, byte locationX, byte locationY)
{
Console.WriteLine(playerID+""+ locationX+""+ locationY);
}
}

class Program
{

static void servicefromcode()
{
BindingElementCollection bindingElements = new BindingElementCollection();
ReliableSessionBindingElement session = new ReliableSessionBindingElement();
session.Ordered = true;
bindingElements.Add(session);
bindingElements.Add(new CompositeDuplexBindingElement());
bindingElements.Add(transport)
Binding playerInfoBinding = new CustomBinding(bindingElements);
Uri playerInfoAddress = new Uri("soap.udp://192.168.72.157:16000/");
using (ServiceHost service = new ServiceHost(typeof(playerInfoService)))
{
service.AddServiceEndpoint(typeof(IUpdatePlayerInfoContract), playerInfoBinding, playerInfoAddress);
service.Open();
}

}


static void Main(string[] args)
{
servicefromcode();
}
}
}



but when i am running this program, i am getting exception

(The CustomBinding on the ServiceEndpoint with contract 'IUpdatePlayerInfoContract' lacks a TransportBindingElement. Every binding must have at least one binding element that derives from TransportBindingElement.)


Please tell me how i can solve this problem. Thank's for given interest in my post.
Member 10080434 31-May-13 8:17am View    
Sir please share Connectivity with jquery and wcf by which i can do. i am trying but yet not done.