예제 #1
0
 private void ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)
 {
     HasConnection = true;
     var socket = new ComplexStreamSocket(args.Socket);
     StartStreaming(socket);
     HasConnection = false;
 }
예제 #2
0
 private bool Stream(ComplexStreamSocket socket)
 {
     bool continueStreaming = true;
     try
     {
         var message = socket.DataReader.GetMessage();
         var result = _actions.Response(message);
         Debug.WriteLine("Sending " + message);
         continueStreaming = socket.DataWriter.WriteMessage(result);
     }
     catch (Exception exception)
     {
         continueStreaming = false;
         Debug.WriteLine(SocketError.GetStatus(exception.HResult));
     }
     return continueStreaming;
 }
예제 #3
0
 void StartStreaming(ComplexStreamSocket socket)
 {
     while (Stream(socket));
 }
예제 #4
0
 public StreamRequester()
 {
     _socket = new ComplexStreamSocket(new StreamSocket());
 }