Click here to Skip to main content
11,644,731 members (72,177 online)
Click here to Skip to main content

Network Stuff (easy socket v3)

, 2 Jun 2005 170.5K 5K 132
Rate this:
Please Sign up or sign in to vote.
A class with event handlers for TCP, UDP or ICMP sockets; includes ping, traceroute, whois, ARP, and IPHelper functions and raw packets forging/ capturing.

Because of errors between VS 2002 and 2003, I've decided to put the two projects to solve resx and obsolete warning troubles.

Sample Image - networkstuff.jpg

Introduction

This code contains a class for socket: ICMP, TCP, UDP, raw TCP, raw UDP, raw IP, and a class for IPHelper functions. All the classes for socket are made with the same view: provide handler for events like connected, closed, closed_by_remote_side, data_arrival, error ....

The sample project is included in beta version, it provides a graphical interface for Telnet, ping, traceroute, whois, packet capture, packet forging, scanning, viewing stats (IPHelper sample), sending ARP, DNS, wake and shutdown on LAN.

How to use

See the following sample for TCP:

easy_socket.tcp.Socket_Data clt;
clt=new easy_socket.tcp.Socket_Data();

// add events
clt.event_Socket_Data_Closed_by_Remote_Side+= new 
  easy_socket.tcp.Socket_Data_Closed_by_Remote_Side_EventHandler(
  socket_closed_by_remote_side);
clt.event_Socket_Data_Connected_To_Remote_Host +=new 
  easy_socket.tcp.Socket_Data_Connected_To_Remote_Host_EventHandler(
  socket_connected_to_remote_host);
clt.event_Socket_Data_DataArrival +=new 
  easy_socket.tcp.Socket_Data_DataArrival_EventHandler(socket_data_arrival);
clt.event_Socket_Data_Error+=new 
  easy_socket.tcp.Socket_Data_Error_EventHandler(socket_error);
  
// connect
clt.connect("127.0.0.1",80);

// handlers
protected void 
    socket_closed_by_remote_side(easy_socket.tcp.Socket_Data sender, 
    EventArgs e)
{

  // handler code
}

protected void 
    socket_connected_to_remote_host(easy_socket.tcp.Socket_Data sender, 
    EventArgs e)
{
  // handler code
}

protected void socket_data_arrival(easy_socket.tcp.Socket_Data sender, 
                         easy_socket.tcp.EventArgs_ReceiveDataSocket e)
{
    string strdata=System.Text.Encoding.Default.GetString(e.buffer, 
                                                0, e.buffer_size );
}

protected void socket_error(easy_socket.tcp.Socket_Data sender, 
                         easy_socket.tcp.EventArgs_Exception e)
{
    string strerror=e.exception.Message;
}

As you can see, you can save a lot of time using these classes.

History

  • 28 Feb 05 - updated VS.NET 2003 source code.
  • 09 May 05
    • Began Telnet protocol implementation.
    • Interactive TCP/UDP added.
    • Some bug corrections.
  • 03 Jun 05
    • Stat graphs added.
    • Interface improvement.
    • Telnet horizontal tab bug removed.
    • More bug corrections.

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

Share

About the Author


You may also be interested in...

Comments and Discussions

 
AnswerRe: How could we act on Routing Table? Pin
Anonymous16-May-05 9:07
sussAnonymous16-May-05 9:07 
GeneralRe: How could we act on Routing Table? Pin
Anonymous18-May-05 0:37
sussAnonymous18-May-05 0:37 
GeneralHaving problem with packet forging... Pin
Anonymous3-May-05 1:24
sussAnonymous3-May-05 1:24 
GeneralRe: Having problem with packet forging... [modified] Pin
Landarzar11-Jun-06 22:43
memberLandarzar11-Jun-06 22:43 
QuestionBlocking IP Packets? Pin
Mdg27-Apr-05 8:56
memberMdg27-Apr-05 8:56 
GeneralGPL... Pin
IGx8927-Mar-05 1:33
memberIGx8927-Mar-05 1:33 
GeneralRe: GPL... Pin
rantanplanisback29-Mar-05 6:49
memberrantanplanisback29-Mar-05 6:49 
GeneralRe: GPL... Pin
IGx8929-Mar-05 6:59
memberIGx8929-Mar-05 6:59 
GeneralRe: GPL... Pin
rantanplanisback29-Mar-05 8:42
memberrantanplanisback29-Mar-05 8:42 
GeneralRe: GPL... Pin
IGx8929-Mar-05 10:28
memberIGx8929-Mar-05 10:28 
GeneralRe: GPL... Pin
pedrito6810-May-05 5:35
memberpedrito6810-May-05 5:35 
GeneralRe: GPL... Pin
Robert M. Bouwens9-May-05 19:58
memberRobert M. Bouwens9-May-05 19:58 
GeneralRe: GPL... Pin
Sean McCormack3-Jun-05 6:14
memberSean McCormack3-Jun-05 6:14 
GeneralRe: GPL... [modified] Pin
Ryan L. Schneider24-Jul-06 5:33
memberRyan L. Schneider24-Jul-06 5:33 
GeneralTCP SYN SYN/ACK issues Pin
banduraj15-Mar-05 8:56
memberbanduraj15-Mar-05 8:56 
GeneralRe: TCP SYN SYN/ACK issues Pin
rantanplanisback22-Mar-05 11:24
memberrantanplanisback22-Mar-05 11:24 
GeneralSource code formatting Suggestion Pin
mrbelles27-Feb-05 18:17
membermrbelles27-Feb-05 18:17 
GeneralRe: Source code formatting Suggestion Pin
mrbelles27-Feb-05 18:31
membermrbelles27-Feb-05 18:31 
GeneralRe: Source code formatting Suggestion Pin
jacquelin.potier3-Mar-05 10:32
sussjacquelin.potier3-Mar-05 10:32 
GeneralRe: Source code formatting Suggestion Pin
Unruled Boy9-May-05 18:41
memberUnruled Boy9-May-05 18:41 
GeneralGot 1 errors, 3 Warning Pin
anonymous....29-Jan-05 3:40
sussanonymous....29-Jan-05 3:40 
GeneralRuntime Exceptions Pin
dfhgesart29-Jan-05 3:55
sussdfhgesart29-Jan-05 3:55 
GeneralRe: Runtime Exceptions Pin
jacquelin.potier8-Feb-05 1:50
sussjacquelin.potier8-Feb-05 1:50 
GeneralRe: Got 1 errors, 3 Warning Pin
jacquelin.potier5-Feb-05 5:36
sussjacquelin.potier5-Feb-05 5:36 
QuestionDid anyone got similar error ? Pin
scott_wu21-Dec-04 17:08
memberscott_wu21-Dec-04 17:08 
GeneralTCPSniffer Pin
ynik15-Oct-04 1:50
memberynik15-Oct-04 1:50 
GeneralRe: TCPSniffer Pin
Anonymous15-Oct-04 7:30
sussAnonymous15-Oct-04 7:30 
GeneralMissing Resources Pin
kiddjoe11-Oct-04 6:00
memberkiddjoe11-Oct-04 6:00 
GeneralRe: Missing Resources Pin
rantanplanisback11-Oct-04 8:54
memberrantanplanisback11-Oct-04 8:54 
GeneralRe: Missing Resources Pin
rantanplanisback12-Oct-04 8:48
memberrantanplanisback12-Oct-04 8:48 
QuestionWarning CS0618. Can i fix it? Pin
Angel Tsvetkov11-Oct-04 0:31
memberAngel Tsvetkov11-Oct-04 0:31 
AnswerRe: Warning CS0618. Can i fix it? Pin
rantanplanisback11-Oct-04 8:51
memberrantanplanisback11-Oct-04 8:51 
GeneralRe: Warning CS0618. Can i fix it? Pin
rantanplanisback12-Oct-04 8:47
memberrantanplanisback12-Oct-04 8:47 
GeneralCapturing tcp Pin
ynik8-Oct-04 5:29
memberynik8-Oct-04 5:29 
GeneralRe: Capturing tcp Pin
rantanplanisback8-Oct-04 6:11
memberrantanplanisback8-Oct-04 6:11 
GeneralRe: Capturing tcp Pin
ynik8-Oct-04 6:22
memberynik8-Oct-04 6:22 
GeneralRe: Capturing tcp Pin
rantanplanisback11-Oct-04 8:58
memberrantanplanisback11-Oct-04 8:58 
GeneralRe: Capturing tcp Pin
ynik11-Oct-04 9:32
memberynik11-Oct-04 9:32 
GeneralRe: Capturing tcp Pin
rantanplanisback11-Oct-04 10:07
memberrantanplanisback11-Oct-04 10:07 
GeneralRe: Capturing tcp Pin
dfhgesart18-Feb-05 5:51
memberdfhgesart18-Feb-05 5:51 
GeneralRe: Capturing tcp Pin
icer139-Oct-05 4:52
membericer139-Oct-05 4:52 
GeneralOther errors as well...... Pin
Keith Vinson6-Oct-04 8:14
memberKeith Vinson6-Oct-04 8:14 
GeneralRe: Other errors as well...... Pin
rantanplanisback6-Oct-04 9:02
memberrantanplanisback6-Oct-04 9:02 
GeneralRe: Other errors as well...... Pin
Keith Vinson6-Oct-04 9:35
memberKeith Vinson6-Oct-04 9:35 
GeneralRe: Other errors as well...... Pin
rantanplanisback7-Oct-04 6:18
memberrantanplanisback7-Oct-04 6:18 
GeneralRe: Other errors as well...... Pin
Keith Vinson7-Oct-04 6:24
memberKeith Vinson7-Oct-04 6:24 
GeneralError! Pin
gidora6665-Oct-04 20:53
sussgidora6665-Oct-04 20:53 
GeneralRe: Error! Pin
rantanplanisback6-Oct-04 9:18
memberrantanplanisback6-Oct-04 9:18 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150731.1 | Last Updated 3 Jun 2005
Article Copyright 2004 by rantanplanisback
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid