Communication between Silverlight and WCF (3) lodging to console interaction data with net.tcp bindings

Source: Internet
Author: User

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);
    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.