Effect
First look at the effect of the basic logic is two people through the Silverlight end, the use of TCP protocol to the server to continuously transfer video, the server received video, will detect the video is sent to who, and then callback to a client to receive and display the video.
Realize
Service contract definition for duplex
[ServiceContract (callbackcontract=typeof
(ichatservicecallback))] public
interface Ichatservice
{
[OperationContract]
void Sendvideo (Uservideo uservideo);
}
[ServiceContract]
Public interface Ichatservicecallback
{
[OperationContract (isoneway=true)]
void Getvideos (list< Uservideo> Listvideos);
}
Data contract, composed of three parts, sender, receiver and video stream, convenient for the server to judge, select the received callback handle.
[DataContract]
public class Uservideo
{
[DataMember] public
string UserName {get; set;}
[DataMember]
public string Partnername {set;
[DataMember]
Public byte[] Videobyte {set; get;}
}