Beispiel #1
0
 /// <summary>
 /// Sends data through server socket to specified endpoint
 /// </summary>
 /// <param name="s">String to send</param>\
 /// <param name="endPoint">Destination endpoint to snd data to</param>
 /// <returns>true if data was sent successfully, false otherwise</returns>
 protected bool serverSend(string s, IPEndPoint endPoint)
 {
     if (!tcpServer.Started || !tcpServer.IsConnected(endPoint))
     {
         //Console("Can`t Send through server to " + endPoint.ToString() + ": " + (s.Length > 100 ? s.Substring(0, 100) : s));
         return(false);
     }
     tcpServer.SendTo(endPoint, s);
     //Console("Sent to " + endPoint.ToString() + " clients on server: " + s);
     return(true);
 }
Beispiel #2
0
        private void Parse(string s, IPEndPoint remoteEndPoint)
        {
            RemoteStartupRequest  request;
            RemoteStartupResponse response;
            string serialized;

            try
            {
                request = RemoteStartupRequest.FromXml(s);
            }
            catch { request = null; }
            if (request == null)
            {
                //response = new RemoteStartupResponse(request, false, "Invalid request");
                return;
            }
            else
            {
                response = Execute(request);
            }
            serialized = RemoteStartupResponse.ToXml(response);
            server.SendTo(remoteEndPoint, serialized);
        }