[Mono-dev] Async socket connection problem on FreeBSD

Allan Hsu allan at counterpop.net
Sun Feb 12 22:20:51 EST 2006


I used to have this same problem on OS X. You may want to try the  
latest release (1.1.13.2) to see if the problem still exists (it has  
at least been fixed on OS X).

	-Allan
--
Allan Hsu <allan at counterpop dot net>
1E64 E20F 34D9 CBA7 1300  1457 AC37 CBBB 0E92 C779


On Feb 11, 2006, at 6:40 AM, Alex Chudnovsky wrote:

> Hi all,
>
> Apologies for not posting to FreeBSD specific list but my attempts  
> to subscribe to it did not seem to have succeeded.
>
> The test case below is for an issue on Mono v1.1.12 running on  
> FreeBSD - basically if asyncronous socket connection is being made  
> then it never succeeds - it just hangs out there and callback never  
> happens. Syncronous version of connect works fine - in the test  
> case by default async connection will be attempted but if any  
> command line arguements used then syncronous will be done.
>
> Any ideas would be appreciated.
>
> /* ************************************************************ */
> using System;
> using System.Net;
> using System.Net.Sockets;
>
> namespace Majestic12
> {
>    /// <summary>
>    /// SocketTest: test of socket connection failure on Mono  
> running on FreeBSD
>    /// </summary>
>    class SocketTest
>    {
>
>        [STAThread]
>        static void Main(string[] args)
>        {
>            bool bUseAsync=true;
>
>            if(args.Length==0)
>                Console.WriteLine("No params detected, will use  
> ASYNC socket operation, put anything to make it use SYNCronous  
> request");
>            else
>                  bUseAsync=false;
>
>
>            // known high-uptime host: www.bbc.co.uk
>            string sIP="212.58.224.125";
>            int iPort=80;
>
>            SocketTest oST=new SocketTest();
>            oST.Start(sIP,iPort,bUseAsync);
>        }
>
>        Socket oConn=null;
>
>        void Start(string sIP,int iPort,bool bUseAsync)
>        {
>            Console.WriteLine("Trying to connect to {0}:{1} using  
> {2} IO",sIP,iPort,bUseAsync ? "ASYNCronous" : "SYNCronous");
>
>            IPEndPoint oEP=new IPEndPoint(IPAddress.Parse(sIP),iPort);
>
>            oConn=new Socket 
> (oEP.Address.AddressFamily,SocketType.Stream,ProtocolType.Tcp);
>
>            if(bUseAsync)
>                oConn.BeginConnect(oEP,new AsyncCallback 
> (EndConnect),this);
>            else
>            {
>                oConn.Connect(oEP);
>                Console.WriteLine("SYNC IO successfully worked!");
>            }
>
>            Console.WriteLine("Press ENTER to exit - if you used  
> ASYNC IO then wait for callback confirmation");
>            Console.ReadLine();
>        }
>
>        /// <summary>
>        /// This function will be called when using AsyncIO
>        /// </summary>
>        void EndConnect(IAsyncResult oAR)
>        {
>            Console.WriteLine("ASYNC EndConnect callback received!");
>
>            try
>            {
>                SocketTest oThis=(SocketTest) oAR.AsyncState;
>
>                oThis.oConn.EndConnect(oAR);
>            }
>            catch(SocketException oEx)
>            {
>                Console.WriteLine("SOCKET ERROR: "+oEx.ToString());
>            }
>            catch(Exception oEx)
>            {
>                Console.WriteLine("GENERAL ERROR: "+oEx.ToString());
>            }
>        }
>    }
> }
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list