예제 #1
0
        public void Connect(string hostname, int port)
        {
            // http://bugs.php.net/bug.php?id=44335
            if (hostname == "localhost")
            {
                hostname = "127.0.0.1";
            }
            else
            {
                hostname = Native.API.gethostbyname(hostname);
            }


            var Client = new __Socket
            {
                InternalHandler = Native.API.fsockopen(hostname, port)
            };

            if (Client.InternalHandler == null)
            {
                throw new Exception("Native.API.fsockopen failed");
            }

            this.Client = (Socket)(object)Client;
        }
예제 #2
0
		public void Connect(string hostname, int port)
		{
			// http://bugs.php.net/bug.php?id=44335
			if (hostname == "localhost")
				hostname = "127.0.0.1";
			else
				hostname = Native.API.gethostbyname(hostname);


			var Client = new __Socket
			{
				InternalHandler = Native.API.fsockopen(hostname, port)
			};

			if (Client.InternalHandler == null)
				throw new Exception("Native.API.fsockopen failed");

			this.Client = (Socket)(object)Client;
		}