Click here to Skip to main content
15,900,589 members
Home / Discussions / C#
   

C#

 
GeneralRe: how can i send data by using connection of another program? Pin
musefan17-Mar-09 6:06
musefan17-Mar-09 6:06 
GeneralRe: how can i send data by using connection of another program? Pin
Frozzeg17-Mar-09 6:19
Frozzeg17-Mar-09 6:19 
GeneralRe: how can i send data by using connection of another program? Pin
Frozzeg17-Mar-09 6:23
Frozzeg17-Mar-09 6:23 
GeneralRe: how can i send data by using connection of another program? Pin
Colin Angus Mackay17-Mar-09 6:40
Colin Angus Mackay17-Mar-09 6:40 
GeneralRe: how can i send data by using connection of another program? Pin
Teuz17-Mar-09 23:58
Teuz17-Mar-09 23:58 
QuestionThread.Sleep() Pin
mrithula817-Mar-09 4:49
mrithula817-Mar-09 4:49 
AnswerRe: Thread.Sleep() Pin
musefan17-Mar-09 4:55
musefan17-Mar-09 4:55 
GeneralRe: Thread.Sleep() Pin
mrithula817-Mar-09 5:08
mrithula817-Mar-09 5:08 
Please give me your suggestion asap

  public UdpServer()
        {
            try
            {
                startServer = new Thread(new ThreadStart(start_server));
                startServer.Start();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                //startServer.Abort();
            }

           Thread.Sleep(20000);
            try
            {               
                
                startServer2 = new Thread(new ThreadStart(start_server2));                
                startServer2.Start();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                //startServer2.Abort();
            }

        } public static void start_server()
        {
           
                IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 10001);
            try
            {
                Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                newsock.Bind(ipep);
                Console.WriteLine("Waiting for a client...");

                while (true)
                {  //IPEndPoint sender = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8050);
                        EndPoint tmpRemote = (EndPoint)ipep;
                        // EndPoint tmpRemote = (sender);

                        byte[] data = new byte[1024];
                        Console.WriteLine("hai");

                        int recv = newsock.ReceiveFrom(data, 0, data.Length, SocketFlags.None, ref tmpRemote);
                        
                        Console.WriteLine("Message received from {0}:", tmpRemote.ToString());
                        Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));//hello is received  

                        data = new byte[1024];
                        string ss = "Welcome to the Server";
                        data = Encoding.ASCII.GetBytes(ss);
                        newsock.SendTo(data, 0, data.Length, SocketFlags.None, tmpRemote);

                        Console.WriteLine("\nSent Acknowledgement");
               

                    }
            }
                    catch (SocketException e)
                    {
                        Console.WriteLine(e.Message);
                    }


                    //start_server();
                    //startServer.Start();            

        }
public static void start_server2()
{//same as above
}

GeneralRe: Thread.Sleep() Pin
dan!sh 17-Mar-09 5:19
professional dan!sh 17-Mar-09 5:19 
GeneralRe: Thread.Sleep() Pin
musefan17-Mar-09 5:19
musefan17-Mar-09 5:19 
QuestionAn exception has been thrown by the type initializers for 'java.io.File'. Pin
abbd17-Mar-09 3:28
abbd17-Mar-09 3:28 
AnswerRe: An exception has been thrown by the type initializers for 'java.io.File'. Pin
led mike17-Mar-09 4:36
led mike17-Mar-09 4:36 
AnswerRe: An exception has been thrown by the type initializers for 'java.io.File'. Pin
musefan17-Mar-09 4:53
musefan17-Mar-09 4:53 
QuestionWebBrowser and AxWebBrowser differences Pin
Member 465172917-Mar-09 3:14
Member 465172917-Mar-09 3:14 
AnswerRe: WebBrowser and AxWebBrowser differences Pin
led mike17-Mar-09 4:37
led mike17-Mar-09 4:37 
GeneralRe: WebBrowser and AxWebBrowser differences Pin
Member 465172918-Mar-09 0:40
Member 465172918-Mar-09 0:40 
GeneralRe: WebBrowser and AxWebBrowser differences Pin
led mike18-Mar-09 5:53
led mike18-Mar-09 5:53 
Questionsystem information Pin
shefa' isied17-Mar-09 3:08
shefa' isied17-Mar-09 3:08 
AnswerRe: system information Pin
Eddy Vluggen17-Mar-09 3:15
professionalEddy Vluggen17-Mar-09 3:15 
GeneralRe: system information Pin
shefa' isied17-Mar-09 3:24
shefa' isied17-Mar-09 3:24 
GeneralRe: system information Pin
Eddy Vluggen17-Mar-09 4:10
professionalEddy Vluggen17-Mar-09 4:10 
AnswerRe: system information Pin
musefan17-Mar-09 3:21
musefan17-Mar-09 3:21 
QuestionModifying Windows Service app.config file Pin
User 265531917-Mar-09 1:57
User 265531917-Mar-09 1:57 
AnswerRe: Modifying Windows Service app.config file Pin
Michael Bookatz17-Mar-09 2:35
Michael Bookatz17-Mar-09 2:35 
GeneralRe: Modifying Windows Service app.config file Pin
User 265531917-Mar-09 2:41
User 265531917-Mar-09 2:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.