hello sir,
With your advice I update my redhat9 to fedral4(kernel 2.6.11), but the socket 
still can't be set timeout property. What is wrong with it? And I also have a 
problem with Process.GetProcesses(), it can't get all processes in current 
machine.
Would you do me a favor to help me again please? Thank you very much!
Here is the source code:

using System;
using System.Net.Sockets;
using System.Net;
using System.Runtime.InteropServices;
using System.IO;
using System.Diagnostics;
namespace CommTest
{
        class Class1
        {
                [STAThread]
                static void Main(string[] args)
                {
                        //it can't work in fedral core 4(kernel 2.6.11),but 
works well in winXP
                        Socket TCPSocket=new 
Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
                        //following 2 functions cause a exception:non-block 
socket would block
                        
TCPSocket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.SendTimeout,1000);
                        
TCPSocket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.ReceiveTimeout,1000);
                        
                        IPAddress ConnIP=IPAddress.Parse("127.0.0.1");
                        IPEndPoint SensorServer=new IPEndPoint(ConnIP,6000);
                        TCPSocket.Bind(SensorServer);
                        TCPSocket.Listen(1);
                        Console.WriteLine("CommServ is listening...");
                        Socket AcceptSocket=TCPSocket.Accept();//throw a 
exception:non-block socket would block
                        Console.WriteLine("CommClient is accepted...");
                        if(AcceptSocket.Connected)
                        {
                                byte[] RcvBuf=new byte[1024];
                                AcceptSocket.Receive(RcvBuf);
                                Process[] Ps=Process.GetProcesses();//It 
dosen't work, only get itself
                                foreach(Process p in Ps)
                                {
                                        Console.WriteLine(p.ProcessName);//only 
output itself, not all processes in current machine,Why?
                                }
                                AcceptSocket.Send(RcvBuf);
                        }
                        AcceptSocket.Close();
                        TCPSocket.Close();
                }
        }
}

LiLing

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to