Click here to Skip to main content
15,886,422 members
Articles / Programming Languages / C#

Network Stuff (easy socket v3)

Rate me:
Please Sign up or sign in to vote.
4.87/5 (52 votes)
2 Jun 2005 215.9K   6.1K   137  
A class with event handlers for TCP, UDP or ICMP sockets; includes ping, traceroute, whois, ARP, and IPHelper functions and raw packets forging/ capturing.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Network_Stuff
{
	/// <summary>
	/// Summary description for FormTCPInteractiveProxyServer.
	/// </summary>
	public class FormTCPInteractiveProxyServer : Network_Stuff.FormTCPServer
	{
        private string remote_srv_ip="127.0.0.1";
        private int remote_srv_port=6501;

        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;
        public FormTCPInteractiveProxyServer()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
        }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {

        }
        #endregion

        public void new_tcp_interactive_proxy_server(string srv_proxy_ip,int srv_proxy_port,string remote_srv_ip,int remote_srv_port)
        {
            base.new_tcp_server(srv_proxy_ip,srv_proxy_port);
            this.Text="Interactive Proxy server on "+srv_proxy_ip+":"+srv_proxy_port.ToString()+" for "+remote_srv_ip+":"+remote_srv_port.ToString();
            this.remote_srv_ip=remote_srv_ip;
            this.remote_srv_port=remote_srv_port;
        }

        protected override void make_new_form_with_principal_thread(System.Net.Sockets.Socket socket)
        {
            FormTCPInteractive frm_clt=new FormTCPInteractive();
            frm_clt.set_mdi_parent(this.MdiParent);
            frm_clt.Show();
            frm_clt.new_tcp_interactive(socket,this.remote_srv_ip,this.remote_srv_port);
        }
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
France France

Comments and Discussions