Ejemplo n.º 1
0
        /// <summary>
        /// server receives data
        /// </summary>
        /// <param name="server">server object</param>
        private static void Update(dpslamServer server, ArrayList buffer)
        {
            while (server.GetNoOfConnectedClients() > 0)
            {            
	            if (buffer.Count > 1)
	            {
	                int client_number = (int)buffer[1];
	                
	                // process the receive buffer	                    
                    if (dpslamServer.EndOfReceive((string)buffer[0]))
                    {
                        server.ProcessReceiveBuffer(client_number, buffer);
                    }
                    else
                    {
                        string buffer_str = ConsolidateBuffer(client_number, buffer);
                        if (dpslamServer.EndOfReceive(buffer_str))
                        {
                            server.ProcessReceiveBuffer(client_number, buffer);
                        }
                    }
	                
	                //Console.WriteLine("buffer size = " + buffer.Count.ToString());
	            }
	            System.Threading.Thread.Sleep(5);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// server receives data
        /// </summary>
        /// <param name="server">server object</param>
        private static void Update(dpslamServer server, ArrayList buffer)
        {
            while (server.GetNoOfConnectedClients() > 0)
            {
                if (buffer.Count > 1)
                {
                    int client_number = (int)buffer[1];

                    // process the receive buffer
                    if (dpslamServer.EndOfReceive((string)buffer[0]))
                    {
                        server.ProcessReceiveBuffer(client_number, buffer);
                    }
                    else
                    {
                        string buffer_str = ConsolidateBuffer(client_number, buffer);
                        if (dpslamServer.EndOfReceive(buffer_str))
                        {
                            server.ProcessReceiveBuffer(client_number, buffer);
                        }
                    }

                    //Console.WriteLine("buffer size = " + buffer.Count.ToString());
                }
                System.Threading.Thread.Sleep(5);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// constructor
 /// </summary>
 public ThreadServerReceive(WaitCallback callback, dpslamServer server, ArrayList receive_buffer)
 {
     if (callback == null) throw new ArgumentNullException("callback");
     _callback = callback;
     _server = server;
     _buffer = receive_buffer;
 }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            // ensure that the program isn't run more than once
            bool mutex_ok;
            System.Threading.Mutex m = new System.Threading.Mutex(true, "dpslamserver", out mutex_ok);

            // extract command line parameters
            ArrayList parameters = commandline.ParseCommandLineParameters(args, "-", GetValidParameters());

            string forced = commandline.GetParameterValue("force", parameters);

            if ((!mutex_ok) && (forced == ""))
            {
                Console.WriteLine("This service is already running");
            }
            else
            {        
                string help_str = commandline.GetParameterValue("help", parameters);
                if (help_str != "")
                {
                    ShowHelp();
                }
                else
                {
                    int PortNumber = 1055;
                    string port_str = commandline.GetParameterValue("port", parameters);
                    if (port_str != "") PortNumber = Convert.ToInt32(port_str);
					
					int no_of_stereo_cameras = 1;
                    string no_of_stereo_cameras_str = commandline.GetParameterValue("cams", parameters);
					if (no_of_stereo_cameras_str != "")
					{
						no_of_stereo_cameras = Convert.ToInt32(no_of_stereo_cameras_str);
					}

                    Console.WriteLine("DP-SLAM Server version 0.1");
                    
                    dpslamServer server = null;
                    
                    // create the server
	                server = new dpslamServer(no_of_stereo_cameras);
	                    
                    // start the server
                    server.Start(PortNumber);

                    while ((server.Running) && 
                           (server.kill == false))
                    {
                        System.Threading.Thread.Sleep(30);
                    }
                }
                
                // keeping the dream alive
                GC.KeepAlive(m);
            }
                                    
            
        }
Ejemplo n.º 5
0
 /// <summary>
 /// constructor
 /// </summary>
 public ThreadServerReceive(WaitCallback callback, dpslamServer server, ArrayList receive_buffer)
 {
     if (callback == null)
     {
         throw new ArgumentNullException("callback");
     }
     _callback = callback;
     _server   = server;
     _buffer   = receive_buffer;
 }