Click here to Skip to main content
Licence 
First Posted 5 Oct 2004
Views 142,167
Bookmarked 124 times

Network Stuff (easy socket v3)

By | 2 Jun 2005 | Article
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

About the Author

rantanplanisback



France France

Member

Jacquelin POTIER
http://jacquelin.potier.free.fr/

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralFInding my own Extrenal IP address PinmemberAlexEvans18:58 30 Jan '09  
GeneralRe: FInding my own Extrenal IP address PinmemberSaksida Bojan19:00 24 Aug '09  
GeneralARP returned MAC is not correct on Vista Pinmemberkelly_liu7:24 25 Aug '08  
GeneralRe: ARP returned MAC is not correct on Vista Pinmemberkelly_liu7:35 25 Aug '08  
Questionplease help me .. Pinmembermicrogroup23:37 20 Oct '07  
GeneralVS 2005 PinmemberSniper16712:10 20 Jul '07  
GeneralRe: VS 2005 PinmemberRanjan.D3:38 15 Aug '07  
GeneralRe: VS 2005 Pinmembervbytesdc10:20 30 Sep '07  
GeneralRe: VS 2005 Pinmemberanimalishuang22:03 15 Nov '07  
GeneralNot thread safe! PinmemberGreg Cadmes7:28 11 Sep '06  
GeneralRe: Not thread safe! Pinmemberrantanplanisback10:14 11 Sep '06  
Generalgreat job Pinmemberanimalishuang22:32 22 Jul '06  
GeneralPacket generation Pinmembersimon.wellborne18:26 9 Jun '05  
Generaltcp client server Pinmembervbytesdc19:29 5 Jun '05  
GeneralRe: tcp client server Pinmemberrantanplanisback8:15 7 Jun '05  
GeneralRe: tcp client server PinmemberUnruled Boy15:53 7 Jun '05  
Generalmissing types PinmemberUnruled Boy16:15 3 Jun '05  
GeneralRe: missing types Pinmemberrantanplanisback8:12 7 Jun '05  
GeneralRe: missing types PinmemberUnruled Boy15:52 7 Jun '05  
GeneralRe: missing types Pinmemberyezie21:23 26 Apr '06  
Generalarp_header error PinmemberRoelf3:49 17 May '05  
GeneralRe: arp_header error PinsussAnonymous10:39 17 May '05  
just remove it from project. Arp can't be forge from windows API (windows just allows to access IP stack). It was a try before a removal. I do appoligize it still in vs2002 source code. Remember the vs 2002 project is no more maintained and still contains severals bugs removed in the 2003 projects.
Best Regards
Jacquelin
Generalarp_header error PinmemberRoelf3:46 17 May '05  
QuestionHow could we act on Routing Table? PinsussAnonymous5:49 16 May '05  
AnswerRe: How could we act on Routing Table? PinsussAnonymous9:07 16 May '05  

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.

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