Using Sockets

fthomas137

Client
Регистрация
18.06.2011
Сообщения
91
Благодарностей
11
Баллы
0
Hey admins,

Question, is there any likelihood that you would be interested in building a module in code creator to automate code in a 'socket'? Ubot has this feature and it basically lets you run things super fast within a hidden, no graphics, no js environment that is created and torn down after the socket commands are completed. It really is a great tool for doing things like pulling information from Google and the such.

Frank
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
Hey Frank.
Did you come across curl? Curl library for .net may do the trick for you.
 

fthomas137

Client
Регистрация
18.06.2011
Сообщения
91
Благодарностей
11
Баллы
0
ahhhh. good idea. Do you know any resources that are great to learn this from boss?

Frank
 

darkdiver

Administrator
Команда форума
Регистрация
13.01.2009
Сообщения
2 284
Благодарностей
2 728
Баллы
113
It is better to use native .NET structures, to download simple parts.
http://msdn.microsoft.com/en-US/library/system.net.httpwebrequest.getresponse.aspx

PHP:
using System;
using System.Net;
using System.Text;
using System.IO;


    public class Test
    {
        // Specify the URL to receive the request.
        public static void Main (string[] args)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create (args[0]);

            // Set some reasonable limits on resources used by this request
            request.MaximumAutomaticRedirections = 4;
            request.MaximumResponseHeadersLength = 4;
            // Set credentials to use for this request.
            request.Credentials = CredentialCache.DefaultCredentials;
            HttpWebResponse response = (HttpWebResponse)request.GetResponse ();

            Console.WriteLine ("Content length is {0}", response.ContentLength);
            Console.WriteLine ("Content type is {0}", response.ContentType);

            // Get the stream associated with the response.
            Stream receiveStream = response.GetResponseStream ();

            // Pipes the stream to a higher level stream reader with the required encoding format. 
            StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8);

            Console.WriteLine ("Response stream received.");
            Console.WriteLine (readStream.ReadToEnd ());
            response.Close ();
            readStream.Close ();
        }
    }
It is better to use only manged resources in your modules, because it will work on both 32 and 64 bit platforms correctly.
 
  • Спасибо
Реакции: bigcajones

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)