Click here to Skip to main content
16,004,969 members
Home / Discussions / C#
   

C#

 
AnswerRe: Override inherited delegates??? Pin
lsugirljte23-Oct-06 11:23
lsugirljte23-Oct-06 11:23 
QuestionGenerics: Is there a Synchronized Hashtable equivalent??? Pin
LongRange.Shooter23-Oct-06 4:08
LongRange.Shooter23-Oct-06 4:08 
AnswerRe: Generics: Is there a Synchronized Hashtable equivalent??? Pin
ednrgc23-Oct-06 4:18
ednrgc23-Oct-06 4:18 
GeneralRe: Generics: Is there a Synchronized Hashtable equivalent??? Pin
LongRange.Shooter23-Oct-06 6:55
LongRange.Shooter23-Oct-06 6:55 
Questionhow to Export DataGridView to excel in c# 2005 ? Pin
hdv21223-Oct-06 3:08
hdv21223-Oct-06 3:08 
QuestionRemoting Question Pin
Inkyskin_UK23-Oct-06 2:28
Inkyskin_UK23-Oct-06 2:28 
AnswerRe: Remoting Question Pin
LongRange.Shooter23-Oct-06 4:05
LongRange.Shooter23-Oct-06 4:05 
GeneralRe: Remoting Question Pin
Inkyskin_UK23-Oct-06 4:14
Inkyskin_UK23-Oct-06 4:14 
Closing the channel is the bit thats confusing me - its only a form within the app, so when I close that form, I need to close the current connection, so that when I relaunch the form again it will accept a new IP.

Im new to remoting, so sorry if I am missing something simple lol

Here is the full code to date:

using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Runtime.Remoting;<br />
using System.Runtime.Remoting.Channels;<br />
using System.Runtime.Remoting.Channels.Http;<br />
using RemProcs;<br />
<br />
namespace Softcode_Network_Tools<br />
{<br />
    public partial class viewProcesses : Form<br />
    {<br />
        public viewProcesses()<br />
        {<br />
            InitializeComponent();<br />
        }<br />
<br />
        public Form1 frm1;<br />
        public string connIP;<br />
        public string connPORT = "8011";<br />
<br />
        public void InitRemoteServer()<br />
        {<br />
            try<br />
            {<br />
                HttpChannel channel = new HttpChannel();<br />
                ChannelServices.RegisterChannel(channel);<br />
                RemotingConfiguration.RegisterWellKnownClientType(<br />
                    typeof(procDLL),<br />
                    "http://" + connIP + ":" + connPORT + "/procDLL");<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                <br />
            }<br />
        }<br />
<br />
        private void viewProcesses_Load(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                this.Text = "View " + ((Form1)frm1).selected_name + "'s Processes";<br />
                label1.Text = "Connecting to: " + ((Form1)frm1).selected_ip + "...";<br />
                connIP = ((Form1)frm1).selected_ip;<br />
                // Windows account name is LABEL 2!<br />
                <br />
                try<br />
                {<br />
                    InitRemoteServer();<br />
                }<br />
                catch (Exception ex)<br />
                {<br />
                    //ChannelServices.UnregisterChannel(channel);<br />
                    InitRemoteServer();<br />
                }<br />
                server1 = new procDLL();<br />
                string allProcsRunning = server1.return_processes();<br />
                string[] arrProcs = new string[200];<br />
                char[] splitter = {':'};<br />
                arrProcs = allProcsRunning.Split(splitter);<br />
                // Being updating the listview<br />
                this.listView1.Items.Clear();<br />
                this.listView1.BeginUpdate();<br />
<br />
                for (int x = 0; x < arrProcs.Length; x++)<br />
                {<br />
                    if (arrProcs[x] != "-")<br />
                    {<br />
                        if (arrProcs[x] != " ")<br />
                        {<br />
                            if (arrProcs[x] != "")<br />
                            {<br />
                                ListViewItem lvi;<br />
                                lvi = new ListViewItem();<br />
                                lvi.Text = arrProcs[x];<br />
                                this.listView1.Items.Add(lvi);<br />
                            }<br />
                        }<br />
                    }<br />
                }<br />
                this.listView1.EndUpdate();<br />
                listView1.Sorting = SortOrder.Ascending;<br />
                label2.Text = "Windows Account Name: " + server1.return_user();<br />
                label2.Visible = true;<br />
                label1.Text = "Connected to: " + connIP + ".";<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                label1.Text = "Unable to connect to " + connIP + ".";<br />
                MessageBox.Show(ex.ToString());<br />
            }<br />
            <br />
        }<br />
<br />
        private void button3_Click(object sender, EventArgs e)<br />
        {<br />
            this.Dispose();<br />
        }<br />
    }<br />
}

GeneralRe: Remoting Question Pin
LongRange.Shooter23-Oct-06 9:49
LongRange.Shooter23-Oct-06 9:49 
QuestionWndProc : on windows command ? Pin
vincent3123-Oct-06 2:22
vincent3123-Oct-06 2:22 
AnswerRe: WndProc : on windows command ? Pin
Ed.Poore23-Oct-06 4:04
Ed.Poore23-Oct-06 4:04 
AnswerRe: WndProc : on windows command ? Pin
Dave Kreskowiak23-Oct-06 4:21
mveDave Kreskowiak23-Oct-06 4:21 
QuestionRe: WndProc : on windows command ? Pin
vincent3123-Oct-06 4:37
vincent3123-Oct-06 4:37 
AnswerRe: WndProc : on windows command ? Pin
S. Senthil Kumar23-Oct-06 8:26
S. Senthil Kumar23-Oct-06 8:26 
QuestionRe: WndProc : on windows command ? Pin
vincent3124-Oct-06 3:43
vincent3124-Oct-06 3:43 
AnswerRe: WndProc : on windows command ? Pin
duanvinait25-Jan-21 20:13
duanvinait25-Jan-21 20:13 
Questionasynchrounous web methgod call Pin
Thakur Vikas23-Oct-06 1:54
Thakur Vikas23-Oct-06 1:54 
AnswerRe: asynchrounous web methgod call Pin
Stefan Troschuetz23-Oct-06 3:06
Stefan Troschuetz23-Oct-06 3:06 
QuestionCalling a Method with a Variable as its Name Pin
Gareth H23-Oct-06 1:31
Gareth H23-Oct-06 1:31 
AnswerRe: Calling a Method with a Variable as its Name Pin
Robert Rohde23-Oct-06 1:39
Robert Rohde23-Oct-06 1:39 
GeneralRe: Calling a Method with a Variable as its Name Pin
Gareth H23-Oct-06 2:46
Gareth H23-Oct-06 2:46 
QuestionsplitContainer Pin
alpha_1023-Oct-06 0:48
alpha_1023-Oct-06 0:48 
AnswerRe: splitContainer Pin
Ed.Poore23-Oct-06 4:02
Ed.Poore23-Oct-06 4:02 
QuestionRe: splitContainer Pin
alpha_1023-Oct-06 4:16
alpha_1023-Oct-06 4:16 
AnswerRe: splitContainer Pin
Ed.Poore23-Oct-06 5:13
Ed.Poore23-Oct-06 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.