Network Stuff (easy socket v3)






4.87/5 (47 votes)
Oct 5, 2004

222969

6174
A class with event handlers for TCP, UDP or ICMP sockets; includes ping, traceroute, whois, ARP, and IPHelper functions and raw packets forging/ capturing.
- Download source code for VS 2003 with resx - 740 Kb
- Download source code for VS 2002 with resx - 224 Kb
Because of errors between VS 2002 and 2003, I've decided to put the two projects to solve resx and obsolete warning troubles.
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.