Recent projects are relatively tight, blog time is basically used to see the document and video, I am grateful to the eldest brother gave so much time for me to study, several schemes have been I to shoot, because there are to take into account other modules, video chat peer-to-peer mode also in Silverlight under can't get, see The only example is actually based on Livemessage, Silverlight fast support Peer-to-peer bar!! Currently in the data delivery of the basic determination of the use of WCF to do everything, including chat, video and file transfer, but can not use the HTTP protocol, instead of using net.tcp to do, direct host to the console, tried to try IIS, but more complex, We'll have to debug tomorrow. The WCF Service host to IIS. There are brothers said WCF in the file delivery is not ideal, first out of the prototype, the latter as far as possible or to the socket closer.
First say today's demo, because I basically still gradual code transfer, first did the service to the console, and directly using the console to do the client's way.
Server-side code is simply written to a file, or a few previous methods, send information and receive information
Public
class Chatservice:ichatservice
{
private static list<messageinfo> listmessages = new List <MessageInfo> ();
public void SendMessage (Messageinfo message)
{
listmessages.add (message);
}
Public list<messageinfo> getmessages (string userName, String partnername)
{
var List = Listmessages.where
(m=>m.partnername==username&&m.username==partnername). ToList ();
Listmessages.removeall (m => m.partnername = = UserName && m.username
= partnername);
return list;
}
[ServiceContract]
Public interface Ichatservice
{
[operationcontract]
void SendMessage (Messageinfo message);
[OperationContract]
List<messageinfo> getmessages (String username,string partnername);