WCF based full duplex service issue

Discussion in 'ASP .Net' started by Nadeem Ashraf, Nov 3, 2009.

  1. Hi,

    We are working on a Silverlight 3 based tool that we call "Live Presenter".
    Briefly speaking, the purpose of this tool is to provide an environment
    where a teacher/presentation host can push himself live to other users (with
    the help of a camera and a software tool like Expression Encoder; for
    example). Apart from the live video, a presenter can also push selected
    multimedia content from his library including video, audio, image, text and
    form etc. which may serve as a subject reference material during
    presentation. The attendees/students on the other hand can also connect
    through the same tool and watch the presentation live, as it is being
    conducted by the presenter.

    In order to push the messages from the client to the server and then pass
    those messages around to various different connected clients, we are using
    WCF full duplex messaging service. So for example, when a presenter tries to
    push a video content to clients, a message is sent to the messaging service
    which then sends the same message to each of the connected clients of that
    specific session. On receiving the message, source of a medialement based
    control is set to the url passed in the message.

    We have used the following URLs for reference in building this service:

    http://weblogs.asp.net/dwahlin/arch...ht-client-with-wcf-duplex-service-part-i.aspx
    http://weblogs.asp.net/dwahlin/arch...client-with-a-wcf-duplex-service-part-ii.aspx

    Having said above, we are running into two very critical issues pertaining
    to this service that is hindering any serious progress since the last one
    week.

    1) The messages are getting lost somewhere in the transit when we try to run
    this tool with even 3-4 members in a session.
    2) The messages are getting significantly delayed in reaching the
    destination

    It is worthwhile to mention that we are using the same service for passing
    around two different categories of messages. one category is our
    command/control messages to push the content around (from presenter's
    perspective) and other category is chat messages.

    Since the Service has to maintain the state of the connected clients, it is
    a singleton service (InstanceContextMode is single). We have tried to set
    ConcurrenyMode to multiple without any luck. We even tried to break the
    Service into two different services each serving different category of
    messages but that didn't solve our problem either.

    Today, we tried to follow a different approach and created a simple Socket
    based chat Service (for processing chat messages only). This looked to be
    fine until 2-3 clients connected with the Server and they started sending
    and receiving messages rapidly. At one point the server failed with the
    following exception:

    Socket Error
    System.InvalidOperationException: An asynchronous socket operation is
    already in progress using this SocketAsyncEventArgs instance.

    Client Code
    args = new SocketAsyncEventArgs();
    args.UserToken = socket;
    args.RemoteEndPoint = endPoint;
    args.SetBuffer(message, 0, message.Length);
    socket.SendAsync(args);

    Just like previous case, we have no clue as to what is wrong here and how
    can this problem be resolved. Can somebody please help or guide us in an
    appropriate manner.

    Thanks.
    Nadeem Ashraf, Nov 3, 2009
    #1
    1. Advertising

  2. Nadeem Ashraf

    Steven Cheng Guest

    Hi Nadeem,

    From your description, you are developing a service which will accept some
    command/chat data from silverlight client and push data to other clients
    connected to the same service, however, you found there occured some
    problems when multiple clients connected to the service, correct?

    As for the service, since it is sending both command and chat data, will
    those message data contains large amount of binary data(such as
    multimediate stream)? As you said that there is message got lost, what kind
    of message does the issue occur against, you can try only sending command
    data or chat data to see whether the problem is specific to certain kind of
    message data.

    Also, you mentioned that even using raw socket programming, you'll get
    following error when have multiple clients connected to server service:

    >>>>>>>>>

    Socket Error
    System.InvalidOperationException: An asynchronous socket operation is
    already in progress using this SocketAsyncEventArgs instance.
    <<<<<<<<<<

    In such case, what is your server-side code look like? It looks like
    something got wrong with the concurrent processing at server-side.

    For WCF, you can turn on tracing to see whether you can get some detailed
    error info in the trace log:

    #Configuring Tracing
    http://msdn.microsoft.com/en-us/library/ms733025.aspx

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.


    --------------------
    >From: "Nadeem Ashraf" <>
    >Subject: WCF based full duplex service issue
    >Date: Tue, 3 Nov 2009 11:59:05 +0500


    >Hi,
    >
    >We are working on a Silverlight 3 based tool that we call "Live

    Presenter".
    >Briefly speaking, the purpose of this tool is to provide an environment
    >where a teacher/presentation host can push himself live to other users

    (with
    >the help of a camera and a software tool like Expression Encoder; for
    >example). Apart from the live video, a presenter can also push selected
    >multimedia content from his library including video, audio, image, text

    and
    >form etc. which may serve as a subject reference material during
    >presentation. The attendees/students on the other hand can also connect
    >through the same tool and watch the presentation live, as it is being
    >conducted by the presenter.
    >


    >
    >
    >
    Steven Cheng, Nov 4, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cyberco

    Splitting a full-duplex socket

    cyberco, Dec 22, 2004, in forum: Java
    Replies:
    31
    Views:
    6,854
  2. Stanislav Tsukrov

    MIDP 2.0 SocketConnection - full duplex

    Stanislav Tsukrov, Mar 5, 2006, in forum: Java
    Replies:
    0
    Views:
    433
    Stanislav Tsukrov
    Mar 5, 2006
  3. Replies:
    3
    Views:
    691
    Greg Ewing
    Mar 31, 2005
  4. Simon
    Replies:
    0
    Views:
    1,007
    Simon
    Oct 13, 2009
  5. Nadeem Ashraf

    WCF based full duplex service issue

    Nadeem Ashraf, Nov 3, 2009, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    916
    Nadeem Ashraf
    Nov 3, 2009
Loading...

Share This Page