简体   繁体   中英

Trying to see DOM in Chrome. Receiving SuperSocket could not be found error

I have a VisualStudio C# WindowFormApplication. I have been trying to get the DOM of a Chrome tab. I came across a post on this site from earlier: Accessing the DOM of a Chrome Tab from Visual Studio

https://github.com/kerryjiang/SuperWebSocket/blob/master/Samples/BasicConsole/Program.cs

It detailed how to accomplish this. I rolled it into my program and I get a "SuperSocket" could not be found an error. There must be a reference I'm missing here, but I can't determine what it is.

using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Diagnostics;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Threading.Tasks;  
using System.Windows.Forms;  
using System.Windows.Automation;  
using SuperSocket.SocketBase;

namespace WindowsFormsApplication1  
{  
public partial class Form1 : System.Windows.Forms.Form  
{  
    //Global Variables  
    public static class Globals  
    {  
        public static bool EditorWorking = false;  
        public static bool WEPrompts = true;  

        public static int EditorCheck = 1;  
        public static String FuncError = "Form_Load";  
        public static String NeedToUpload = "No";  
    }  

    //private System.Windows.Forms.NotifyIcon notifyIcon1;  
    //private System.Windows.Forms.ContextMenu contextMenu1;  
    //private System.Windows.Forms.MenuItem menuItem1;  
    //private System.ComponentModel.IContainer components;  

    public Form1()  
    {  
        //InitializeComponent();  
        StartSuperWebSocket();  
        //CreateTrayIcon();  
    }  

    private void StartSuperWebSocket()  
    {  
        var appServer = new WebSocketServer();  

        //Setup the appServer  
        if (!appServer.Setup(2012)) //Setup with listening port  
        {  
            Console.WriteLine("Failed to setup!");  
            Console.ReadKey();  
            return;  
        }  

        appServer.NewMessageReceived += new SessionHandler<WebSocketSession, string>(appServer_NewMessageReceived);  

        Console.WriteLine();  

        //Try to start the appServer  
        if (!appServer.Start())  
        {  
            Console.WriteLine("Failed to start!");  
            Console.ReadKey();  
            return;  
        }  
    }  
}  
}

You are correct the dependencies seems to be messed up.

You need to install the following nuget packages:

  1. SuperSocket
  2. SuperSocket.WebSocket
  3. SuperSocket.Engine

Also please add the following in your code:

using SuperSocket.WebSocket;

Might be a good idea to tell the maintainer of the library that his examples are not compiling.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM