http://bugzilla.novell.com/show_bug.cgi?id=498507

User [email protected] added comment
http://bugzilla.novell.com/show_bug.cgi?id=498507#c7





--- Comment #7 from Gonzalo Paniagua Javier <[email protected]>  2009-04-29 
09:42:59 MDT ---
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Threading;
using System.Net;

namespace SocketTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Socket socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);

            try
            {
                IAsyncResult async = socket.BeginConnect(new
IPEndPoint(IPAddress.Parse("130.57.21.18"), 8888), ConnectCallback,
socket);

                if (!async.AsyncWaitHandle.WaitOne(5000, false))
                {
                    socket.Close();
                }
            }
            catch (Exception se)
            {
                Console.WriteLine(se.Message);
            }
    Console.ReadLine ();
        }

        private static void ConnectCallback(IAsyncResult async)
        {
            Socket socket = (Socket)async.AsyncState;

            try
            {
                socket.EndConnect(async);
            }
            catch (ObjectDisposedException)
            {
                Console.WriteLine("closed");
            }
        }
    }
}

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to