Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Jacob D Dixon

@Jacob D Dixon
About
Posts
82
Topics
20
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Managing windows updates (WUApilib)
    J Jacob D Dixon

    Ahhh I over looked it: http://msdn.microsoft.com/en-us/library/aa386492(v=VS.85).aspx[^] Using IUpdateInstaller2 instead of IUpdateInstaller allows you to forcequiet installs. It doesn't hurt to go through all the references again a few times :-). I will post back if it worked or not.... *Update* Worked pretty good! The only thing is the updates will still fail if it is unable to install silently. The one I tested was Internet Explorer 9. At least this gives me the ability to filter them out and not have it pending for a users input.

    modified on Wednesday, July 13, 2011 10:20 PM

    C# json question

  • Managing windows updates (WUApilib)
    J Jacob D Dixon

    But that isn't using the windows update API. The problem is I'm not exactly sure how or if it is possible to tell using the API which updates require a users input. If it does require a user input I could set it as needed to be manually installed and skip it or fire off another script to manually download the files and run it silently.

    C# json question

  • Managing windows updates (WUApilib)
    J Jacob D Dixon

    I'm working on a application that will manage Windows updates for you (asynchronous). Everything is working except it will popup messages to users. Like when installing Language Packs it will display the installation for that, and if trying to install Internet Explorer 9 it will popup and ask the user to Accept, Ask me Later, or Don't Install. Is there a way to hide everything and just install it? I've search through Microsoft's pages on this API and can't find it. Here is where I perform the install. I didn't include any of the code for the callbacks or downloads because it would a huge post which you all probably wouldn't like lol. If you want me to I can.

    public static void Install(UpdateCollection installs)
    {
    if (installer != null || installs.Count > 0)
    {
    if (updateSession == null)
    updateSession = new UpdateSessionClass();

                try
                {
                    installer = updateSession.CreateUpdateInstaller();
                    installer.Updates = installs;
                    installer.AllowSourcePrompts = false;
                    installer.parentWindow = null;
    
                    WUInstProgress installProgress = new WUInstProgress();
                    WUInstCompleted installCompleted = new WUInstCompleted();
    
                    installCompleted.InstCompleted += new InstCompletedDelegate(installCompleted\_InstCompleted);
                    installer.BeginInstall(installProgress, installCompleted, null);
                }
                catch (Exception ex)
                {
                    ReportError(ex.ToString());
                }
            }
            else
                ReportLog("Install collection was null or empty");
        }
    
    C# json question

  • Handling multiple clients via Sockets
    J Jacob D Dixon

    So only handle so many connections at one time… but do not reject any? It almost sounds like if I don't get the calculation right I could end up in a loop (meaning some agent actions not being performed in the correct amount of time before it tries to checkin again)

    C# question sysadmin agentic-ai tutorial

  • Handling multiple clients via Sockets
    J Jacob D Dixon

    I haven't read that link you put up yet but I kind of skimmed through it. It appears that it is using libraries newer than .NET 2.0. I should of mentioned that I wanted to stick with nothing above .NET 2.0. Now for stuff like Labtech I really think they are using a web service (which I do not want to use). I can't really use UDP because the agent has to be able to retrieve data back from that server when it checks in. This is because the server will not really have access to any agent directly since they are on different networks. So the agent has to be the one to start the connection and accept data back.

    C# question sysadmin agentic-ai tutorial

  • Handling multiple clients via Sockets
    J Jacob D Dixon

    Interesting.. never seen that used.. I will have to check more into that.

    C# question sysadmin agentic-ai tutorial

  • Handling multiple clients via Sockets
    J Jacob D Dixon

    Hey there! Been a while… took a little break from bugging you all with questions ;-). Anyways I was working on a server/client project so I could just become familiar with socket programming before I took a little "programming" break. Now that I'm going to continue it I had a few questions about trying what I'm attempting to do. What I want is to create a Agent-Based monitoring application. So the idea would be to have the server sitting out on the WAN listening for connections from the agents. The agents will upload data and will perform more actions in the future. So what is the best way to handle multiple connections? The connections could range anywhere from 1 to 750 agents that checkin every 30 seconds. Some products that come in mind is Labtech, Kaseya, and Zenith. I was using async sockets and see tons of people out there just creating new threads on a new connection, but surely this will kill the server when you get many connections. Should I be using a thread pool (haven't dove into how to do this yet), creating new threads, async sockets, or what? Thanks!

    C# question sysadmin agentic-ai tutorial

  • Cisco IPSec VPN connect but no traffic? [SOLVED]
    J Jacob D Dixon

    Someone from Cisco forms helped me:

    access-list 150 deny ip 192.168.11.0 0.0.0.255 192.168.1.0 0.0.0.255
    access-list 150 permit ip 192.168.11.0 0.0.0.255 any
    ip nat inside source list 150 interface fastethernet0/0 overload
    no ip nat inside source list 1 interface fastethernet0/0 overload

    System Admin cryptography csharp ios security debugging

  • How to automatically restore the previous session after a RDP connection closed?
    J Jacob D Dixon

    You can login as console using the /console switch on older RDP or /admin on new RDP (vista, win7, 2008 , etc). Will connect you to same one each time

    System Admin question help tutorial career

  • Cisco IPSec VPN connect but no traffic? [SOLVED]
    J Jacob D Dixon

    Well I've never used CodeProject for anything other than C# related questions.. so here it goes: For exercise.. I am trying to create a secure VPN tunnel between this Cisco 1841 Router and a Sonicwall router. No in both routers it shows that the tunnel is active. The problem is I cannot ping / access any computers between the LANs. On the Sonicwall side I have a computer at 192.168.1.250. While on the Cisco side I have a computer at 192.168.11.55. I can not reach either one of them.. evn though the tunnel is active:

    inbound esp sas:
    spi: 0xD1BC1B8E(3518765966)
    transform: esp-256-aes esp-sha-hmac ,
    in use settings ={Tunnel, }
    conn id: 3003, flow_id: FPGA:3, crypto map: vpn
    sa timing: remaining key lifetime (k/sec): (4541007/2298)
    IV size: 16 bytes
    replay detection support: Y
    Status: ACTIVE

    outbound esp sas:
    spi: 0xAE589C1E(2925042718)
    transform: esp-256-aes esp-sha-hmac ,
    in use settings ={Tunnel, }
    conn id: 3004, flow_id: FPGA:4, crypto map: vpn
    sa timing: remaining key lifetime (k/sec): (4541027/2297)
    IV size: 16 bytes
    replay detection support: Y
    Status: ACTIVE

    Current configuration : 3972 bytes
    !
    version 12.4
    no service pad
    service tcp-keepalives-in
    service tcp-keepalives-out
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname CompsysRouter
    !
    boot-start-marker
    boot-end-marker
    !
    enable secret *****************
    enable password ***********
    !
    aaa new-model
    !
    !
    !
    aaa session-id common
    ip cef
    !
    !
    !
    !
    no ip domain lookup
    ip domain name ********.local
    ip inspect name myfw http timeout 3600
    ip inspect name myfw tcp timeout 3600
    ip inspect name myfw udp timeout 3600
    ip inspect name myfw dns timeout 3600
    ip auth-proxy max-nodata-conns 3
    ip admission max-nodata-conns 3
    !
    !
    crypto pki trustpoint TP-self-signed-1821875492
    enrollment selfsigned
    subject-name cn=IOS-Self-Signed-Certificate-1821875492
    revocation-check none
    rsakeypair TP-self-signed-1821875492
    !
    !
    crypto pki certificate chain TP-self-signed-1821875492
    certificate self-signed 01
    30820245 308201AE A0030201 02020101 300D0609 2A864886 F70D0101 04050030
    31312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274
    69666963 6174652D 31383231 38373534 3932301E 170D3130 31323130 32333433
    35325A17 0D323030 31303130 30303030 305A3031 312F302D 06035504 03132649

    System Admin cryptography csharp ios security debugging

  • Should I be using inhertance for this?
    J Jacob D Dixon

    Thanks guys! I really didn't plan any of this to be honest. I was just trying to learn and figure out Sockets. Either way I would like to design a product like the LabTech software I was speaking of, but like you mentioned I should plan it out before trying such a project.

    C# sysadmin agentic-ai oop performance question

  • Should I be using inhertance for this?
    J Jacob D Dixon

    I've been thinking a lot about this and looking at some of the other post. In my situation I am leaning towards leaving it the way it is. (As in not using inheritance). I mean if you really think about it, any update would require the server to be updated along with the agent on the systems. I don't see a way around this. I do like the idea of sending the four characters to specify the type of message that was being sent.

    C# sysadmin agentic-ai oop performance question

  • Should I be using inhertance for this?
    J Jacob D Dixon

    I think using a web service would make the task easier. I just want to get a handle on Sockets and a good "design" of a client / server model. Erik also suggested the same thing as you about the communication layer. Saying that the server should handle anything thrown at it pretty much. I just haven't been able to wrap my head around his suggestions on how to make it work for me for this particular project. I mean technically right now it does handle everything. It detects if it is a Commons[] object, and if it is then does something with it. If it isn't a Commons[] object then it just does nothing with it. But the way I have it designed.. any future updates would require the server to be updated (which would mean the agents couldn't check in at that time), and the agents to be updated depending on what is being added. Like if I wanted to make v2 be able to reboot the agents to safe mode, then most likely it would require a server & agent upgrade. I just don't see how to get around doing this task without an upgrade later on. I hope that makes sense. I guess I'm just looking for pointers on making my classes more "professional" and easier to manage. I mean I think they are easy to manage because I built them lol.

    C# sysadmin agentic-ai oop performance question

  • Should I be using inhertance for this?
    J Jacob D Dixon

    PIEBAL, Everything I do is just an exercise to learn new things. I'm not currently a programmer or in school for doing this stuff. (I am in school for programming but they teach you very basic crap, and nothing like this... at least the school I'm in). I'm currently a Network Engineer and setup this software called LabTech. It is a remote monitoring / control application. You have your server out on the internet, and install agents to different locations (different networks). They report stuff like hardware, processes, services, and more. I know that it is made with VB.net and possibly some C#. Anyways I just wanted to try to make my own applicaton that was similiar. So far I have my server and agent. They communicate and transfer data (my Commons object) over TCP (Socket Class). The server holds in memory "pending commands". With each Commons object is arrays, Agent ID, and other things (you can see this class in the first post). So basically we are just transferring that back and forth. So when the agent checks in, the server looks in memory (a List) to see if there are any Commons object that pertains to that agent (by AgentID.. GUID). So lets say I want a certain agent to get a list of processes and return to server. I manually add (for right now) a commons object to the List on the server. The agent checks in. Server queries the List object for objects that match that Agent's ID. Server returns array of Commons[] object (because it might have more than one command) to client Client performs the commands Client returns array of Commons[] object to server Server loops through and inserts the data into SQL. So if we are wanting the agent to get its Services and send to data we will set the Commons Object TASK to Services and the client will populate the Services[] array (Which is just another class that holds stuff like ServiceName, Status, etc). For this exercise I rather not use a web service. I wanted to learn more about TCP protocol. The server is using the Socket class asyncronous and the client is not. Here is a post where Luc helped me out with my server's Socket implementation: http://www.codeproject.com/Forums/1649/Csharp.aspx?fid=1649&fr=151#xx0xx[^] (this is working fine). Hope that helps you understand more of what I'm doing :

    C# sysadmin agentic-ai oop performance question

  • Should I be using inhertance for this?
    J Jacob D Dixon

    Well I am sad to say that I have usually avoided inheritance because I don't have a full understanding of it and/or I haven't yet found a good use for it. So my newest learning project is a client / server (have been posting about it you may notice alot). A brief overview of what I have been doing is passing my custom object over TCP. My custom object is a seperate DLL project. Erik didn't like it but to be honest I haven't came up with a better way or fully understood. AFter reviewing hie article that he pointed me to I'm just wondering if I should be using a interface and/or inheritance. Here is my Commons object:

    \[Serializable\]
    public class Commons
    {
        public Commons()
        {
            TimeStamp = DateTime.Now;
        }
    
        public enum Tasks
        {
            CHECKIN,            // Checkin which updates the checkin time of agents (Default)
            DISKDRIVE,          // So the agent / server will update the disk dives
            DRIVEINFO,          // So the agent / server will update the drive info
            FAN,                // So the agent / server will update the fan info
            MESSAGE,            // Used by server to send message to agent
            PHYSICALMEMORY,     // So the agent / server will update the physical memory info
            PRINTERS,           // So the agent / server will update the printers
            PROCESSES,          // So the agent / server will update the processes
            REGISTER,           // So the agent / server will register a new agent
            SERVICES,           // So the agent / server will update the services
            SOFTWARE,           // So the agent / server will update the software
    
            // Commands
            ADD\_CMD,            // \* Used by control center to add agent command
            CLOSECD,            // Causes the agent to close the CD ROM
            GET\_ALL,            // \* Used by control center to get all information on a certain agent
            REBOOT,             // Causes the agent to reboot
            OPENCD,             // Causes the agent to open the CD ROM
            SHUTDOWN            // Causes the agent to shutdown
        }
    
        /// <summary>
        /// The task we are performing
        /// </summary>
        public Tasks Task { get; set; }
    
        /// <summary>
        /// The tasks we are adding to memory
        /// </summary>
        public Tasks AddTask { get; set; }
    
    C# sysadmin agentic-ai oop performance question

  • Needed to Create a Scrolling Ticker with LinkLabel Functionality
    J Jacob D Dixon

    Just an idea... but when you are adding the Image to the Ticker, why don't you pass along the URL that is associated with the Image and set the "Tag" attribute to the URL. That way when the Image is clicked you can get the URL from that.

    C# graphics

  • Can not deserialize [modified]
    J Jacob D Dixon

    Ah yeah I got it now. Luc I just want to thank you for your help. Here is what I have now and it seems to be working well:

    int bytesRead = handler.EndReceive(iar);
    if (bytesRead > 0)
    {
    if (state.Length == 0)
    {
    state.Length = BitConverter.ToInt32(state.buffer, 0);

                        Logging.Log(handler.RemoteEndPoint.ToString() + " is about to send " + state.Length.ToString() + " bytes", true);
                        handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0,
                            new AsyncCallback(ReadCallback), state);
                    }
                    else
                    {
                        state.Length -= bytesRead;
                        state.ms.Write(state.buffer, 0, bytesRead);
    
                        if (state.Length > 0)
                            handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0,
                                new AsyncCallback(ReadCallback), state);
                        else
                        {
                            Logging.Log("Finished receiving " + state.ms.Length.ToString() + " bytes from " +
                                            handler.RemoteEndPoint.ToString(), true);
    
                            state.ms.Seek(0, SeekOrigin.Begin);
                            IFormatter formatter = new BinaryFormatter();
                            object receivedObject = null;
    
                            try
                            {
                                receivedObject = formatter.Deserialize(state.ms);
    
    C# json help csharp visual-studio sysadmin

  • Can not deserialize [modified]
    J Jacob D Dixon

    Ahhhhh ok I see what you are doing now.. but if I'm calling BeginReceive again within the Callback then I don't think that will work. Because the first thing you are doing is checking if Length == 0. There are two times this will happen... for the first BeginReceive and also when we read all the bytes (because we know we are done reading when Length == 0). I get the idea.. unless I'm missing smoething.. changing it now

    C# json help csharp visual-studio sysadmin

  • Can not deserialize [modified]
    J Jacob D Dixon

    Ok I fixed it but still have a little problem: Agent Log:

    Sent notification to server that we were about to send 20230 bytes
    Transferred the following actions to server: SERVICES,

    Server Log:

    [12/2/2010 9:48:56 AM]: -- 192.168.1.163:21064 has connected to the server
    [12/2/2010 9:48:56 AM]: 192.168.1.163:21064 is about to send 20230 bytes
    [12/2/2010 9:48:56 AM]: Finished receiving 8760 bytes from 192.168.1.163:21064
    [12/2/2010 9:48:56 AM]: Agent 192.168.1.163:21064 sent back null
    [12/2/2010 9:48:56 AM]: Finished sending 118 bytes to 192.168.1.163:21064

    So as you can see the agent is sending all the data, but the server is only getting 8760 bytes? Why is the server not reading all of the data? State Object:

        public Socket worker = null;
        public int BufferSize = 4;
        public byte\[\] buffer;
        public MemoryStream ms = new MemoryStream();
    

    Server:

    int bytesRead = handler.EndReceive(iar);
    if (bytesRead > 0)
    {
    if (state.BufferSize == 4)
    {
    state.BufferSize = BitConverter.ToInt32(state.buffer, 0);
    state.buffer = new byte[state.BufferSize];

                        Logging.Log(handler.RemoteEndPoint.ToString() + " is about to send " + state.BufferSize.ToString() + " bytes", true);
                        handler.BeginReceive(state.buffer, 0, state.BufferSize, 0,
                            new AsyncCallback(ReadCallback), state);
                    }
                    else
                    {
                        state.ms.Write(state.buffer, 0, bytesRead);
    
                        Logging.Log("Finished receiving " + state.ms.Length.ToString() + " bytes from " +
                            handler.RemoteEndPoint.ToString(), true);
    
                        // All data has been received from client
                        state.ms.Seek(0, SeekOrigin.Begin);
                        IFormatter formatter = new BinaryFormatter();
                        object receivedObject = null;
    
                        try
                        {
                            receivedObject = formatter.Deserialize(state.ms);
                        }
                        catch (SerializationException se)
                        {
                            Logging.Log("Object passed was not capable of being deserialized. Error: " + se.ToString(), false);
    
    C# json help csharp visual-studio sysadmin

  • Can not deserialize [modified]
    J Jacob D Dixon

    Luc, Sorry for sounding dumb.. but what is with the 4 bytes? I'm searching google some more for example code of this but what I find is people doing things differently than what I'm trying to do. I see most of the code using Encoding to get the string until a EOF was passed or something. I guess I could do it that way. Pass the bytes as a string with a and cut off the EOF and convert to integer. I do want to try to understand your method, but right now I'm not fully understanding it. Would you mind providing a short example? [Edit] I'm guessing the 4 bytes would be the BitConverter.GetBytes()..... but how certain is 4 bytes would contain the entire length? I did some test and even with doing like a: byte[] b = new byte[4958454] the array length is still only 4. So let me do some test tomorrow and I'll post what I come up with. Thanks for your help

    modified on Wednesday, December 1, 2010 11:29 PM

    C# json help csharp visual-studio sysadmin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups